From cfe7dcee40869658a8f1770b4a03f0c5c6e21ee5 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 7 May 2026 11:09:58 +0530 Subject: [PATCH 1/5] chore: update Web SDK to 25.1.0 --- .github/workflows/publish.yml | 4 ++-- CHANGELOG.md | 12 +++++++++--- README.md | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- src/client.ts | 20 ++++++++++++++++++-- src/enums/o-auth-provider.ts | 3 +++ src/services/account.ts | 8 ++++---- 8 files changed, 41 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e6ea266e..47ba2484 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@v6 - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: '24.14.1' registry-url: 'https://registry.npmjs.org' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7492c403..e8a81e13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ # Change Log +## 25.1.0 + +* Added: Added `setCookie()` method to `Client` for forwarding incoming `Cookie` headers in server-side runtimes +* Added: Added `Fusionauth`, `Keycloak`, and `Kick` OAuth providers to `OAuthProvider` enum +* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.4` + ## 25.0.0 -* Breaking: Added `unsubscribe()`, `update()`, and `close()` for Realtime subscription lifecycle. -* Added: Added `userPhone` to the `Membership` model. -* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2`. +* Breaking: Added `unsubscribe()`, `update()`, and `close()` to Realtime subscriptions +* Added: Added `userPhone` field to `Membership` model +* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2` ## 24.2.0 diff --git a/README.md b/README.md index 6ed4881e..d52114f0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Web SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/package-lock.json b/package-lock.json index fc146255..0adf962c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appwrite", - "version": "25.0.0", + "version": "25.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "appwrite", - "version": "25.0.0", + "version": "25.1.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index feea2e8e..42b5b992 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "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": "25.0.0", + "version": "25.1.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 6bd679d2..d04d1ed5 100644 --- a/src/client.ts +++ b/src/client.ts @@ -358,6 +358,7 @@ class Client { locale: string; session: string; devkey: string; + cookie: string; impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; @@ -369,6 +370,7 @@ class Client { locale: '', session: '', devkey: '', + cookie: '', impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', @@ -380,8 +382,8 @@ class Client { 'x-sdk-name': 'Web', 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '25.0.0', - 'X-Appwrite-Response-Format': '1.9.2', + 'x-sdk-version': '25.1.0', + 'X-Appwrite-Response-Format': '1.9.4', }; /** @@ -508,6 +510,20 @@ class Client { this.config.devkey = value; return this; } + /** + * Set Cookie + * + * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + * + * @param value string + * + * @return {this} + */ + setCookie(value: string): this { + this.headers['Cookie'] = value; + this.config.cookie = value; + return this; + } /** * Set ImpersonateUserId * diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index efc44844..cc9e340b 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -14,9 +14,12 @@ export enum OAuthProvider { Etsy = 'etsy', Facebook = 'facebook', Figma = 'figma', + Fusionauth = 'fusionauth', Github = 'github', Gitlab = 'gitlab', Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', Linkedin = 'linkedin', Microsoft = 'microsoft', Notion = 'notion', diff --git a/src/services/account.ts b/src/services/account.ts index d15c2c71..5a3f7926 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1863,7 +1863,7 @@ export class Account { * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -1879,7 +1879,7 @@ export class Account { * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -2616,7 +2616,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -2631,7 +2631,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. From 293048353b7770fafb72f26a73e808a10b8a8c3b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 15 May 2026 14:13:04 +0530 Subject: [PATCH 2/5] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 15 +- README.md | 2 +- .../account/create-anonymous-session.md | 3 +- .../account/create-email-password-session.md | 3 +- docs/examples/account/create-email-token.md | 3 +- .../account/create-email-verification.md | 3 +- docs/examples/account/create-jwt.md | 3 +- .../account/create-magic-url-token.md | 3 +- .../account/create-mfa-authenticator.md | 3 +- docs/examples/account/create-mfa-challenge.md | 3 +- .../account/create-mfa-recovery-codes.md | 3 +- .../examples/account/create-o-auth-2-token.md | 3 +- docs/examples/account/create-phone-token.md | 3 +- .../account/create-phone-verification.md | 3 +- docs/examples/account/create-recovery.md | 3 +- docs/examples/account/create-session.md | 3 +- docs/examples/account/create-verification.md | 3 +- docs/examples/account/create.md | 3 +- docs/examples/account/delete-identity.md | 3 +- .../account/delete-mfa-authenticator.md | 3 +- docs/examples/account/delete-session.md | 3 +- docs/examples/account/delete-sessions.md | 3 +- .../account/get-mfa-recovery-codes.md | 3 +- docs/examples/account/get-prefs.md | 3 +- docs/examples/account/get-session.md | 3 +- docs/examples/account/get.md | 3 +- docs/examples/account/list-identities.md | 3 +- docs/examples/account/list-logs.md | 3 +- docs/examples/account/list-mfa-factors.md | 3 +- docs/examples/account/list-sessions.md | 3 +- .../account/update-email-verification.md | 3 +- docs/examples/account/update-email.md | 3 +- .../account/update-magic-url-session.md | 3 +- .../account/update-mfa-authenticator.md | 3 +- docs/examples/account/update-mfa-challenge.md | 3 +- .../account/update-mfa-recovery-codes.md | 3 +- docs/examples/account/update-mfa.md | 3 +- docs/examples/account/update-name.md | 3 +- docs/examples/account/update-password.md | 3 +- docs/examples/account/update-phone-session.md | 3 +- .../account/update-phone-verification.md | 3 +- docs/examples/account/update-phone.md | 3 +- docs/examples/account/update-prefs.md | 3 +- docs/examples/account/update-recovery.md | 3 +- docs/examples/account/update-session.md | 3 +- docs/examples/account/update-status.md | 3 +- docs/examples/account/update-verification.md | 3 +- docs/examples/activities/get-event.md | 16 + docs/examples/activities/list-events.md | 16 + docs/examples/avatars/get-browser.md | 3 +- docs/examples/avatars/get-credit-card.md | 3 +- docs/examples/avatars/get-favicon.md | 3 +- docs/examples/avatars/get-flag.md | 3 +- docs/examples/avatars/get-image.md | 3 +- docs/examples/avatars/get-initials.md | 3 +- docs/examples/avatars/get-qr.md | 3 +- docs/examples/avatars/get-screenshot.md | 3 +- docs/examples/backups/create-archive.md | 17 + docs/examples/backups/create-policy.md | 22 + docs/examples/backups/create-restoration.md | 19 + docs/examples/backups/delete-archive.md | 16 + docs/examples/backups/delete-policy.md | 16 + docs/examples/backups/get-archive.md | 16 + docs/examples/backups/get-policy.md | 16 + docs/examples/backups/get-restoration.md | 16 + docs/examples/backups/list-archives.md | 16 + docs/examples/backups/list-policies.md | 16 + docs/examples/backups/list-restorations.md | 16 + docs/examples/backups/update-policy.md | 20 + .../databases/create-big-int-attribute.md | 23 + .../databases/create-boolean-attribute.md | 21 + docs/examples/databases/create-collection.md | 23 + .../databases/create-datetime-attribute.md | 21 + docs/examples/databases/create-document.md | 3 +- docs/examples/databases/create-documents.md | 19 + .../databases/create-email-attribute.md | 21 + .../databases/create-enum-attribute.md | 22 + .../databases/create-float-attribute.md | 23 + docs/examples/databases/create-index.md | 22 + .../databases/create-integer-attribute.md | 23 + .../examples/databases/create-ip-attribute.md | 21 + .../databases/create-line-attribute.md | 20 + .../databases/create-longtext-attribute.md | 22 + .../databases/create-mediumtext-attribute.md | 22 + docs/examples/databases/create-operations.md | 3 +- .../databases/create-point-attribute.md | 20 + .../databases/create-polygon-attribute.md | 20 + .../create-relationship-attribute.md | 23 + .../databases/create-string-attribute.md | 23 + .../databases/create-text-attribute.md | 22 + docs/examples/databases/create-transaction.md | 3 +- .../databases/create-url-attribute.md | 21 + .../databases/create-varchar-attribute.md | 23 + docs/examples/databases/create.md | 18 + .../databases/decrement-document-attribute.md | 3 +- docs/examples/databases/delete-attribute.md | 18 + docs/examples/databases/delete-collection.md | 17 + docs/examples/databases/delete-document.md | 3 +- docs/examples/databases/delete-documents.md | 19 + docs/examples/databases/delete-index.md | 18 + docs/examples/databases/delete-transaction.md | 3 +- docs/examples/databases/delete.md | 16 + docs/examples/databases/get-attribute.md | 18 + docs/examples/databases/get-collection.md | 17 + docs/examples/databases/get-document.md | 3 +- docs/examples/databases/get-index.md | 18 + docs/examples/databases/get-transaction.md | 3 +- docs/examples/databases/get.md | 16 + .../databases/increment-document-attribute.md | 3 +- docs/examples/databases/list-attributes.md | 19 + docs/examples/databases/list-collections.md | 19 + docs/examples/databases/list-documents.md | 3 +- docs/examples/databases/list-indexes.md | 19 + docs/examples/databases/list-transactions.md | 3 +- docs/examples/databases/list.md | 18 + .../databases/update-big-int-attribute.md | 23 + .../databases/update-boolean-attribute.md | 21 + docs/examples/databases/update-collection.md | 22 + .../databases/update-datetime-attribute.md | 21 + docs/examples/databases/update-document.md | 3 +- docs/examples/databases/update-documents.md | 26 + .../databases/update-email-attribute.md | 21 + .../databases/update-enum-attribute.md | 22 + .../databases/update-float-attribute.md | 23 + .../databases/update-integer-attribute.md | 23 + .../examples/databases/update-ip-attribute.md | 21 + .../databases/update-line-attribute.md | 21 + .../databases/update-longtext-attribute.md | 21 + .../databases/update-mediumtext-attribute.md | 21 + .../databases/update-point-attribute.md | 21 + .../databases/update-polygon-attribute.md | 21 + .../update-relationship-attribute.md | 20 + .../databases/update-string-attribute.md | 22 + .../databases/update-text-attribute.md | 21 + docs/examples/databases/update-transaction.md | 3 +- .../databases/update-url-attribute.md | 21 + .../databases/update-varchar-attribute.md | 22 + docs/examples/databases/update.md | 18 + docs/examples/databases/upsert-document.md | 3 +- docs/examples/databases/upsert-documents.md | 19 + docs/examples/functions/create-deployment.md | 20 + .../functions/create-duplicate-deployment.md | 18 + docs/examples/functions/create-execution.md | 5 +- .../functions/create-template-deployment.md | 22 + docs/examples/functions/create-variable.md | 20 + .../functions/create-vcs-deployment.md | 19 + docs/examples/functions/create.md | 35 + docs/examples/functions/delete-deployment.md | 17 + docs/examples/functions/delete-execution.md | 17 + docs/examples/functions/delete-variable.md | 17 + docs/examples/functions/delete.md | 16 + .../functions/get-deployment-download.md | 18 + docs/examples/functions/get-deployment.md | 17 + docs/examples/functions/get-execution.md | 3 +- docs/examples/functions/get-variable.md | 17 + docs/examples/functions/get.md | 16 + docs/examples/functions/list-deployments.md | 19 + docs/examples/functions/list-executions.md | 3 +- docs/examples/functions/list-runtimes.md | 14 + .../examples/functions/list-specifications.md | 14 + docs/examples/functions/list-variables.md | 18 + docs/examples/functions/list.md | 18 + .../functions/update-deployment-status.md | 17 + .../functions/update-function-deployment.md | 17 + docs/examples/functions/update-variable.md | 20 + docs/examples/functions/update.md | 35 + docs/examples/graphql/mutation.md | 3 +- docs/examples/graphql/query.md | 3 +- docs/examples/health/get-antivirus.md | 14 + docs/examples/health/get-cache.md | 14 + docs/examples/health/get-certificate.md | 16 + docs/examples/health/get-console-pausing.md | 17 + docs/examples/health/get-db.md | 14 + docs/examples/health/get-failed-jobs.md | 17 + docs/examples/health/get-pub-sub.md | 14 + docs/examples/health/get-queue-audits.md | 16 + docs/examples/health/get-queue-builds.md | 16 + .../examples/health/get-queue-certificates.md | 16 + docs/examples/health/get-queue-databases.md | 17 + docs/examples/health/get-queue-deletes.md | 16 + docs/examples/health/get-queue-functions.md | 16 + docs/examples/health/get-queue-logs.md | 16 + docs/examples/health/get-queue-mails.md | 16 + docs/examples/health/get-queue-messaging.md | 16 + docs/examples/health/get-queue-migrations.md | 16 + .../health/get-queue-stats-resources.md | 16 + docs/examples/health/get-queue-usage.md | 16 + docs/examples/health/get-queue-webhooks.md | 16 + docs/examples/health/get-storage-local.md | 14 + docs/examples/health/get-storage.md | 14 + docs/examples/health/get-time.md | 14 + docs/examples/health/get.md | 14 + docs/examples/locale/get.md | 3 +- docs/examples/locale/list-codes.md | 3 +- docs/examples/locale/list-continents.md | 3 +- docs/examples/locale/list-countries-eu.md | 3 +- docs/examples/locale/list-countries-phones.md | 3 +- docs/examples/locale/list-countries.md | 3 +- docs/examples/locale/list-currencies.md | 3 +- docs/examples/locale/list-languages.md | 3 +- .../messaging/create-apns-provider.md | 23 + docs/examples/messaging/create-email.md | 27 + .../examples/messaging/create-fcm-provider.md | 19 + .../messaging/create-mailgun-provider.md | 25 + .../messaging/create-msg-91-provider.md | 21 + docs/examples/messaging/create-push.md | 34 + .../messaging/create-resend-provider.md | 23 + .../messaging/create-sendgrid-provider.md | 23 + docs/examples/messaging/create-sms.md | 22 + .../messaging/create-smtp-provider.md | 29 + docs/examples/messaging/create-subscriber.md | 3 +- .../messaging/create-telesign-provider.md | 21 + .../messaging/create-textmagic-provider.md | 21 + docs/examples/messaging/create-topic.md | 18 + .../messaging/create-twilio-provider.md | 21 + .../messaging/create-vonage-provider.md | 21 + docs/examples/messaging/delete-provider.md | 16 + docs/examples/messaging/delete-subscriber.md | 3 +- docs/examples/messaging/delete-topic.md | 16 + docs/examples/messaging/delete.md | 16 + docs/examples/messaging/get-message.md | 16 + docs/examples/messaging/get-provider.md | 16 + docs/examples/messaging/get-subscriber.md | 17 + docs/examples/messaging/get-topic.md | 16 + docs/examples/messaging/list-message-logs.md | 18 + docs/examples/messaging/list-messages.md | 18 + docs/examples/messaging/list-provider-logs.md | 18 + docs/examples/messaging/list-providers.md | 18 + .../messaging/list-subscriber-logs.md | 18 + docs/examples/messaging/list-subscribers.md | 19 + docs/examples/messaging/list-targets.md | 18 + docs/examples/messaging/list-topic-logs.md | 18 + docs/examples/messaging/list-topics.md | 18 + .../messaging/update-apns-provider.md | 23 + docs/examples/messaging/update-email.md | 27 + .../examples/messaging/update-fcm-provider.md | 19 + .../messaging/update-mailgun-provider.md | 25 + .../messaging/update-msg-91-provider.md | 21 + docs/examples/messaging/update-push.md | 34 + .../messaging/update-resend-provider.md | 23 + .../messaging/update-sendgrid-provider.md | 23 + docs/examples/messaging/update-sms.md | 22 + .../messaging/update-smtp-provider.md | 29 + .../messaging/update-telesign-provider.md | 21 + .../messaging/update-textmagic-provider.md | 21 + docs/examples/messaging/update-topic.md | 18 + .../messaging/update-twilio-provider.md | 21 + .../messaging/update-vonage-provider.md | 21 + .../project/create-android-platform.md | 18 + .../examples/project/create-apple-platform.md | 18 + docs/examples/project/create-ephemeral-key.md | 17 + docs/examples/project/create-key.md | 19 + .../examples/project/create-linux-platform.md | 18 + docs/examples/project/create-mock-phone.md | 17 + docs/examples/project/create-smtp-test.md | 16 + docs/examples/project/create-variable.md | 19 + docs/examples/project/create-web-platform.md | 18 + .../project/create-windows-platform.md | 18 + docs/examples/project/delete-key.md | 16 + docs/examples/project/delete-mock-phone.md | 16 + docs/examples/project/delete-platform.md | 16 + docs/examples/project/delete-variable.md | 16 + docs/examples/project/delete.md | 14 + docs/examples/project/get-email-template.md | 17 + docs/examples/project/get-key.md | 16 + docs/examples/project/get-mock-phone.md | 16 + .../examples/project/get-o-auth-2-provider.md | 16 + docs/examples/project/get-platform.md | 16 + docs/examples/project/get-policy.md | 16 + docs/examples/project/get-variable.md | 16 + docs/examples/project/list-email-templates.md | 17 + docs/examples/project/list-keys.md | 17 + docs/examples/project/list-mock-phones.md | 17 + .../project/list-o-auth-2-providers.md | 17 + docs/examples/project/list-platforms.md | 17 + docs/examples/project/list-policies.md | 17 + docs/examples/project/list-variables.md | 17 + .../project/update-android-platform.md | 18 + .../examples/project/update-apple-platform.md | 18 + docs/examples/project/update-auth-method.md | 17 + .../update-deny-canonical-email-policy.md | 16 + .../update-deny-disposable-email-policy.md | 16 + .../project/update-deny-free-email-policy.md | 16 + .../examples/project/update-email-template.md | 23 + docs/examples/project/update-key.md | 19 + docs/examples/project/update-labels.md | 16 + .../examples/project/update-linux-platform.md | 18 + .../update-membership-privacy-policy.md | 20 + docs/examples/project/update-mock-phone.md | 17 + .../project/update-o-auth-2-amazon.md | 18 + .../examples/project/update-o-auth-2-apple.md | 20 + .../project/update-o-auth-2-auth-0.md | 19 + .../project/update-o-auth-2-authentik.md | 19 + .../project/update-o-auth-2-autodesk.md | 18 + .../project/update-o-auth-2-bitbucket.md | 18 + .../examples/project/update-o-auth-2-bitly.md | 18 + docs/examples/project/update-o-auth-2-box.md | 18 + .../project/update-o-auth-2-dailymotion.md | 18 + .../project/update-o-auth-2-discord.md | 18 + .../project/update-o-auth-2-disqus.md | 18 + .../project/update-o-auth-2-dropbox.md | 18 + docs/examples/project/update-o-auth-2-etsy.md | 18 + .../project/update-o-auth-2-facebook.md | 18 + .../examples/project/update-o-auth-2-figma.md | 18 + .../project/update-o-auth-2-fusion-auth.md | 19 + .../project/update-o-auth-2-git-hub.md | 18 + .../project/update-o-auth-2-gitlab.md | 19 + .../project/update-o-auth-2-google.md | 19 + .../project/update-o-auth-2-keycloak.md | 20 + docs/examples/project/update-o-auth-2-kick.md | 18 + .../project/update-o-auth-2-linkedin.md | 18 + .../project/update-o-auth-2-microsoft.md | 19 + .../project/update-o-auth-2-notion.md | 18 + docs/examples/project/update-o-auth-2-oidc.md | 22 + docs/examples/project/update-o-auth-2-okta.md | 20 + .../project/update-o-auth-2-paypal-sandbox.md | 18 + .../project/update-o-auth-2-paypal.md | 18 + .../examples/project/update-o-auth-2-podio.md | 18 + .../project/update-o-auth-2-salesforce.md | 18 + .../examples/project/update-o-auth-2-slack.md | 18 + .../project/update-o-auth-2-spotify.md | 18 + .../project/update-o-auth-2-stripe.md | 18 + .../update-o-auth-2-tradeshift-sandbox.md | 18 + .../project/update-o-auth-2-tradeshift.md | 18 + .../project/update-o-auth-2-twitch.md | 18 + .../project/update-o-auth-2-word-press.md | 18 + .../examples/project/update-o-auth-2-yahoo.md | 18 + .../project/update-o-auth-2-yandex.md | 18 + docs/examples/project/update-o-auth-2-zoho.md | 18 + docs/examples/project/update-o-auth-2-zoom.md | 18 + docs/examples/project/update-o-auth-2x.md | 18 + .../update-password-dictionary-policy.md | 16 + .../project/update-password-history-policy.md | 16 + .../update-password-personal-data-policy.md | 16 + docs/examples/project/update-protocol.md | 17 + docs/examples/project/update-service.md | 17 + .../project/update-session-alert-policy.md | 16 + .../project/update-session-duration-policy.md | 16 + .../update-session-invalidation-policy.md | 16 + .../project/update-session-limit-policy.md | 16 + docs/examples/project/update-smtp.md | 25 + .../project/update-user-limit-policy.md | 16 + docs/examples/project/update-variable.md | 19 + docs/examples/project/update-web-platform.md | 18 + .../project/update-windows-platform.md | 18 + docs/examples/proxy/create-api-rule.md | 16 + docs/examples/proxy/create-function-rule.md | 18 + docs/examples/proxy/create-redirect-rule.md | 20 + docs/examples/proxy/create-site-rule.md | 18 + docs/examples/proxy/delete-rule.md | 16 + docs/examples/proxy/get-rule.md | 16 + docs/examples/proxy/list-rules.md | 17 + docs/examples/proxy/update-rule-status.md | 16 + docs/examples/sites/create-deployment.md | 21 + .../sites/create-duplicate-deployment.md | 17 + .../sites/create-template-deployment.md | 22 + docs/examples/sites/create-variable.md | 20 + docs/examples/sites/create-vcs-deployment.md | 19 + docs/examples/sites/create.md | 36 + docs/examples/sites/delete-deployment.md | 17 + docs/examples/sites/delete-log.md | 17 + docs/examples/sites/delete-variable.md | 17 + docs/examples/sites/delete.md | 16 + .../examples/sites/get-deployment-download.md | 18 + docs/examples/sites/get-deployment.md | 17 + docs/examples/sites/get-log.md | 17 + docs/examples/sites/get-variable.md | 17 + docs/examples/sites/get.md | 16 + docs/examples/sites/list-deployments.md | 19 + docs/examples/sites/list-frameworks.md | 14 + docs/examples/sites/list-logs.md | 18 + docs/examples/sites/list-specifications.md | 14 + docs/examples/sites/list-variables.md | 18 + docs/examples/sites/list.md | 18 + .../sites/update-deployment-status.md | 17 + docs/examples/sites/update-site-deployment.md | 17 + docs/examples/sites/update-variable.md | 20 + docs/examples/sites/update.md | 36 + docs/examples/storage/create-bucket.md | 26 + docs/examples/storage/create-file.md | 3 +- docs/examples/storage/delete-bucket.md | 16 + docs/examples/storage/delete-file.md | 3 +- docs/examples/storage/get-bucket.md | 16 + docs/examples/storage/get-file-download.md | 3 +- docs/examples/storage/get-file-preview.md | 3 +- docs/examples/storage/get-file-view.md | 3 +- docs/examples/storage/get-file.md | 3 +- docs/examples/storage/list-buckets.md | 18 + docs/examples/storage/list-files.md | 3 +- docs/examples/storage/update-bucket.md | 26 + docs/examples/storage/update-file.md | 3 +- .../tablesdb/create-big-int-column.md | 23 + .../tablesdb/create-boolean-column.md | 21 + .../tablesdb/create-datetime-column.md | 21 + docs/examples/tablesdb/create-email-column.md | 21 + docs/examples/tablesdb/create-enum-column.md | 22 + docs/examples/tablesdb/create-float-column.md | 23 + docs/examples/tablesdb/create-index.md | 22 + .../tablesdb/create-integer-column.md | 23 + docs/examples/tablesdb/create-ip-column.md | 21 + docs/examples/tablesdb/create-line-column.md | 20 + .../tablesdb/create-longtext-column.md | 22 + .../tablesdb/create-mediumtext-column.md | 22 + docs/examples/tablesdb/create-operations.md | 3 +- docs/examples/tablesdb/create-point-column.md | 20 + .../tablesdb/create-polygon-column.md | 20 + .../tablesdb/create-relationship-column.md | 23 + docs/examples/tablesdb/create-row.md | 3 +- docs/examples/tablesdb/create-rows.md | 19 + .../examples/tablesdb/create-string-column.md | 23 + docs/examples/tablesdb/create-table.md | 23 + docs/examples/tablesdb/create-text-column.md | 22 + docs/examples/tablesdb/create-transaction.md | 3 +- docs/examples/tablesdb/create-url-column.md | 21 + .../tablesdb/create-varchar-column.md | 23 + docs/examples/tablesdb/create.md | 18 + .../examples/tablesdb/decrement-row-column.md | 3 +- docs/examples/tablesdb/delete-column.md | 18 + docs/examples/tablesdb/delete-index.md | 18 + docs/examples/tablesdb/delete-row.md | 3 +- docs/examples/tablesdb/delete-rows.md | 19 + docs/examples/tablesdb/delete-table.md | 17 + docs/examples/tablesdb/delete-transaction.md | 3 +- docs/examples/tablesdb/delete.md | 16 + docs/examples/tablesdb/get-column.md | 18 + docs/examples/tablesdb/get-index.md | 18 + docs/examples/tablesdb/get-row.md | 3 +- docs/examples/tablesdb/get-table.md | 17 + docs/examples/tablesdb/get-transaction.md | 3 +- docs/examples/tablesdb/get.md | 16 + .../examples/tablesdb/increment-row-column.md | 3 +- docs/examples/tablesdb/list-columns.md | 19 + docs/examples/tablesdb/list-indexes.md | 19 + docs/examples/tablesdb/list-rows.md | 3 +- docs/examples/tablesdb/list-tables.md | 19 + docs/examples/tablesdb/list-transactions.md | 3 +- docs/examples/tablesdb/list.md | 18 + .../tablesdb/update-big-int-column.md | 23 + .../tablesdb/update-boolean-column.md | 21 + .../tablesdb/update-datetime-column.md | 21 + docs/examples/tablesdb/update-email-column.md | 21 + docs/examples/tablesdb/update-enum-column.md | 22 + docs/examples/tablesdb/update-float-column.md | 23 + .../tablesdb/update-integer-column.md | 23 + docs/examples/tablesdb/update-ip-column.md | 21 + docs/examples/tablesdb/update-line-column.md | 21 + .../tablesdb/update-longtext-column.md | 21 + .../tablesdb/update-mediumtext-column.md | 21 + docs/examples/tablesdb/update-point-column.md | 21 + .../tablesdb/update-polygon-column.md | 21 + .../tablesdb/update-relationship-column.md | 20 + docs/examples/tablesdb/update-row.md | 3 +- docs/examples/tablesdb/update-rows.md | 26 + .../examples/tablesdb/update-string-column.md | 22 + docs/examples/tablesdb/update-table.md | 22 + docs/examples/tablesdb/update-text-column.md | 21 + docs/examples/tablesdb/update-transaction.md | 3 +- docs/examples/tablesdb/update-url-column.md | 21 + .../tablesdb/update-varchar-column.md | 22 + docs/examples/tablesdb/update.md | 18 + docs/examples/tablesdb/upsert-row.md | 3 +- docs/examples/tablesdb/upsert-rows.md | 19 + docs/examples/teams/create-membership.md | 3 +- docs/examples/teams/create.md | 3 +- docs/examples/teams/delete-membership.md | 3 +- docs/examples/teams/delete.md | 3 +- docs/examples/teams/get-membership.md | 3 +- docs/examples/teams/get-prefs.md | 3 +- docs/examples/teams/get.md | 3 +- docs/examples/teams/list-memberships.md | 3 +- docs/examples/teams/list.md | 3 +- .../teams/update-membership-status.md | 3 +- docs/examples/teams/update-membership.md | 3 +- docs/examples/teams/update-name.md | 3 +- docs/examples/teams/update-prefs.md | 3 +- docs/examples/tokens/create-file-token.md | 18 + docs/examples/tokens/delete.md | 16 + docs/examples/tokens/get.md | 16 + docs/examples/tokens/list.md | 19 + docs/examples/tokens/update.md | 17 + docs/examples/users/create-argon-2-user.md | 19 + docs/examples/users/create-bcrypt-user.md | 19 + docs/examples/users/create-jwt.md | 18 + docs/examples/users/create-md-5-user.md | 19 + .../users/create-mfa-recovery-codes.md | 16 + docs/examples/users/create-ph-pass-user.md | 19 + .../users/create-scrypt-modified-user.md | 22 + docs/examples/users/create-scrypt-user.md | 24 + docs/examples/users/create-session.md | 16 + docs/examples/users/create-sha-user.md | 20 + docs/examples/users/create-target.md | 21 + docs/examples/users/create-token.md | 18 + docs/examples/users/create.md | 20 + docs/examples/users/delete-identity.md | 16 + .../users/delete-mfa-authenticator.md | 17 + docs/examples/users/delete-session.md | 17 + docs/examples/users/delete-sessions.md | 16 + docs/examples/users/delete-target.md | 17 + docs/examples/users/delete.md | 16 + docs/examples/users/get-mfa-recovery-codes.md | 16 + docs/examples/users/get-prefs.md | 16 + docs/examples/users/get-target.md | 17 + docs/examples/users/get.md | 16 + docs/examples/users/list-identities.md | 18 + docs/examples/users/list-logs.md | 18 + docs/examples/users/list-memberships.md | 19 + docs/examples/users/list-mfa-factors.md | 16 + docs/examples/users/list-sessions.md | 17 + docs/examples/users/list-targets.md | 18 + docs/examples/users/list.md | 18 + .../users/update-email-verification.md | 17 + docs/examples/users/update-email.md | 17 + docs/examples/users/update-impersonator.md | 17 + docs/examples/users/update-labels.md | 17 + .../users/update-mfa-recovery-codes.md | 16 + docs/examples/users/update-mfa.md | 17 + docs/examples/users/update-name.md | 17 + docs/examples/users/update-password.md | 17 + .../users/update-phone-verification.md | 17 + docs/examples/users/update-phone.md | 17 + docs/examples/users/update-prefs.md | 17 + docs/examples/users/update-status.md | 17 + docs/examples/users/update-target.md | 20 + docs/examples/webhooks/create.md | 24 + docs/examples/webhooks/delete.md | 16 + docs/examples/webhooks/get.md | 16 + docs/examples/webhooks/list.md | 17 + docs/examples/webhooks/update-secret.md | 17 + docs/examples/webhooks/update.md | 23 + package-lock.json | 4 +- package.json | 2 +- src/client.ts | 34 +- src/enums/adapter.ts | 4 + src/enums/attribute-status.ts | 7 + src/enums/auth-method.ts | 9 + src/enums/backup-services.ts | 8 + src/enums/build-runtime.ts | 94 + src/enums/column-status.ts | 7 + src/enums/compression.ts | 5 + src/enums/database-type.ts | 6 + src/enums/databases-index-type.ts | 6 + src/enums/deployment-download-type.ts | 4 + src/enums/deployment-status.ts | 8 + src/enums/email-template-locale.ts | 133 + src/enums/email-template-type.ts | 9 + src/enums/framework.ts | 17 + src/enums/health-antivirus-status.ts | 5 + src/enums/health-check-status.ts | 4 + src/enums/index-status.ts | 7 + src/enums/message-priority.ts | 4 + src/enums/message-status.ts | 7 + src/enums/messaging-provider-type.ts | 5 + src/enums/name.ts | 15 + src/enums/o-auth-2-google-prompt.ts | 5 + src/enums/o-auth-provider.ts | 2 + src/enums/order-by.ts | 4 + src/enums/password-hash.ts | 13 + src/enums/platform-type.ts | 7 + src/enums/project-policy.ts | 11 + src/enums/prompt.ts | 5 + src/enums/protocol-id.ts | 5 + src/enums/proxy-resource-type.ts | 4 + .../proxy-rule-deployment-resource-type.ts | 4 + src/enums/proxy-rule-status.ts | 5 + src/enums/relation-mutate.ts | 5 + src/enums/relationship-type.ts | 6 + src/enums/runtime.ts | 94 + src/enums/scopes.ts | 89 + src/enums/secure.ts | 4 + src/enums/service-id.ts | 19 + src/enums/smtp-encryption.ts | 5 + src/enums/status-code.ts | 6 + src/enums/tables-db-index-type.ts | 6 + src/enums/template-reference-type.ts | 5 + src/enums/vcs-reference-type.ts | 5 + src/index.ts | 51 + src/models.ts | 6790 +++++++++++++++-- src/services/account.ts | 278 +- src/services/activities.ts | 116 + src/services/avatars.ts | 8 + src/services/backups.ts | 754 ++ src/services/databases.ts | 5334 ++++++++++++- src/services/functions.ts | 1938 ++++- src/services/health.ts | 1043 +++ src/services/messaging.ts | 5049 ++++++++++++ src/services/project.ts | 6436 ++++++++++++++++ src/services/proxy.ts | 541 ++ src/services/sites.ts | 1917 +++++ src/services/storage.ts | 428 ++ src/services/tables-db.ts | 5321 ++++++++++++- src/services/tokens.ts | 315 + src/services/users.ts | 3270 ++++++++ src/services/webhooks.ts | 466 ++ 593 files changed, 47621 insertions(+), 1285 deletions(-) create mode 100644 docs/examples/activities/get-event.md create mode 100644 docs/examples/activities/list-events.md create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/databases/create-big-int-attribute.md create mode 100644 docs/examples/databases/create-boolean-attribute.md create mode 100644 docs/examples/databases/create-collection.md create mode 100644 docs/examples/databases/create-datetime-attribute.md create mode 100644 docs/examples/databases/create-documents.md create mode 100644 docs/examples/databases/create-email-attribute.md create mode 100644 docs/examples/databases/create-enum-attribute.md create mode 100644 docs/examples/databases/create-float-attribute.md create mode 100644 docs/examples/databases/create-index.md create mode 100644 docs/examples/databases/create-integer-attribute.md create mode 100644 docs/examples/databases/create-ip-attribute.md create mode 100644 docs/examples/databases/create-line-attribute.md create mode 100644 docs/examples/databases/create-longtext-attribute.md create mode 100644 docs/examples/databases/create-mediumtext-attribute.md create mode 100644 docs/examples/databases/create-point-attribute.md create mode 100644 docs/examples/databases/create-polygon-attribute.md create mode 100644 docs/examples/databases/create-relationship-attribute.md create mode 100644 docs/examples/databases/create-string-attribute.md create mode 100644 docs/examples/databases/create-text-attribute.md create mode 100644 docs/examples/databases/create-url-attribute.md create mode 100644 docs/examples/databases/create-varchar-attribute.md create mode 100644 docs/examples/databases/create.md create mode 100644 docs/examples/databases/delete-attribute.md create mode 100644 docs/examples/databases/delete-collection.md create mode 100644 docs/examples/databases/delete-documents.md create mode 100644 docs/examples/databases/delete-index.md create mode 100644 docs/examples/databases/delete.md create mode 100644 docs/examples/databases/get-attribute.md create mode 100644 docs/examples/databases/get-collection.md create mode 100644 docs/examples/databases/get-index.md create mode 100644 docs/examples/databases/get.md create mode 100644 docs/examples/databases/list-attributes.md create mode 100644 docs/examples/databases/list-collections.md create mode 100644 docs/examples/databases/list-indexes.md create mode 100644 docs/examples/databases/list.md create mode 100644 docs/examples/databases/update-big-int-attribute.md create mode 100644 docs/examples/databases/update-boolean-attribute.md create mode 100644 docs/examples/databases/update-collection.md create mode 100644 docs/examples/databases/update-datetime-attribute.md create mode 100644 docs/examples/databases/update-documents.md create mode 100644 docs/examples/databases/update-email-attribute.md create mode 100644 docs/examples/databases/update-enum-attribute.md create mode 100644 docs/examples/databases/update-float-attribute.md create mode 100644 docs/examples/databases/update-integer-attribute.md create mode 100644 docs/examples/databases/update-ip-attribute.md create mode 100644 docs/examples/databases/update-line-attribute.md create mode 100644 docs/examples/databases/update-longtext-attribute.md create mode 100644 docs/examples/databases/update-mediumtext-attribute.md create mode 100644 docs/examples/databases/update-point-attribute.md create mode 100644 docs/examples/databases/update-polygon-attribute.md create mode 100644 docs/examples/databases/update-relationship-attribute.md create mode 100644 docs/examples/databases/update-string-attribute.md create mode 100644 docs/examples/databases/update-text-attribute.md create mode 100644 docs/examples/databases/update-url-attribute.md create mode 100644 docs/examples/databases/update-varchar-attribute.md create mode 100644 docs/examples/databases/update.md create mode 100644 docs/examples/databases/upsert-documents.md create mode 100644 docs/examples/functions/create-deployment.md create mode 100644 docs/examples/functions/create-duplicate-deployment.md create mode 100644 docs/examples/functions/create-template-deployment.md create mode 100644 docs/examples/functions/create-variable.md create mode 100644 docs/examples/functions/create-vcs-deployment.md create mode 100644 docs/examples/functions/create.md create mode 100644 docs/examples/functions/delete-deployment.md create mode 100644 docs/examples/functions/delete-execution.md create mode 100644 docs/examples/functions/delete-variable.md create mode 100644 docs/examples/functions/delete.md create mode 100644 docs/examples/functions/get-deployment-download.md create mode 100644 docs/examples/functions/get-deployment.md create mode 100644 docs/examples/functions/get-variable.md create mode 100644 docs/examples/functions/get.md create mode 100644 docs/examples/functions/list-deployments.md create mode 100644 docs/examples/functions/list-runtimes.md create mode 100644 docs/examples/functions/list-specifications.md create mode 100644 docs/examples/functions/list-variables.md create mode 100644 docs/examples/functions/list.md create mode 100644 docs/examples/functions/update-deployment-status.md create mode 100644 docs/examples/functions/update-function-deployment.md create mode 100644 docs/examples/functions/update-variable.md create mode 100644 docs/examples/functions/update.md create mode 100644 docs/examples/health/get-antivirus.md create mode 100644 docs/examples/health/get-cache.md create mode 100644 docs/examples/health/get-certificate.md create mode 100644 docs/examples/health/get-console-pausing.md create mode 100644 docs/examples/health/get-db.md create mode 100644 docs/examples/health/get-failed-jobs.md create mode 100644 docs/examples/health/get-pub-sub.md create mode 100644 docs/examples/health/get-queue-audits.md create mode 100644 docs/examples/health/get-queue-builds.md create mode 100644 docs/examples/health/get-queue-certificates.md create mode 100644 docs/examples/health/get-queue-databases.md create mode 100644 docs/examples/health/get-queue-deletes.md create mode 100644 docs/examples/health/get-queue-functions.md create mode 100644 docs/examples/health/get-queue-logs.md create mode 100644 docs/examples/health/get-queue-mails.md create mode 100644 docs/examples/health/get-queue-messaging.md create mode 100644 docs/examples/health/get-queue-migrations.md create mode 100644 docs/examples/health/get-queue-stats-resources.md create mode 100644 docs/examples/health/get-queue-usage.md create mode 100644 docs/examples/health/get-queue-webhooks.md create mode 100644 docs/examples/health/get-storage-local.md create mode 100644 docs/examples/health/get-storage.md create mode 100644 docs/examples/health/get-time.md create mode 100644 docs/examples/health/get.md create mode 100644 docs/examples/messaging/create-apns-provider.md create mode 100644 docs/examples/messaging/create-email.md create mode 100644 docs/examples/messaging/create-fcm-provider.md create mode 100644 docs/examples/messaging/create-mailgun-provider.md create mode 100644 docs/examples/messaging/create-msg-91-provider.md create mode 100644 docs/examples/messaging/create-push.md create mode 100644 docs/examples/messaging/create-resend-provider.md create mode 100644 docs/examples/messaging/create-sendgrid-provider.md create mode 100644 docs/examples/messaging/create-sms.md create mode 100644 docs/examples/messaging/create-smtp-provider.md create mode 100644 docs/examples/messaging/create-telesign-provider.md create mode 100644 docs/examples/messaging/create-textmagic-provider.md create mode 100644 docs/examples/messaging/create-topic.md create mode 100644 docs/examples/messaging/create-twilio-provider.md create mode 100644 docs/examples/messaging/create-vonage-provider.md create mode 100644 docs/examples/messaging/delete-provider.md create mode 100644 docs/examples/messaging/delete-topic.md create mode 100644 docs/examples/messaging/delete.md create mode 100644 docs/examples/messaging/get-message.md create mode 100644 docs/examples/messaging/get-provider.md create mode 100644 docs/examples/messaging/get-subscriber.md create mode 100644 docs/examples/messaging/get-topic.md create mode 100644 docs/examples/messaging/list-message-logs.md create mode 100644 docs/examples/messaging/list-messages.md create mode 100644 docs/examples/messaging/list-provider-logs.md create mode 100644 docs/examples/messaging/list-providers.md create mode 100644 docs/examples/messaging/list-subscriber-logs.md create mode 100644 docs/examples/messaging/list-subscribers.md create mode 100644 docs/examples/messaging/list-targets.md create mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/messaging/list-topics.md create mode 100644 docs/examples/messaging/update-apns-provider.md create mode 100644 docs/examples/messaging/update-email.md create mode 100644 docs/examples/messaging/update-fcm-provider.md create mode 100644 docs/examples/messaging/update-mailgun-provider.md create mode 100644 docs/examples/messaging/update-msg-91-provider.md create mode 100644 docs/examples/messaging/update-push.md create mode 100644 docs/examples/messaging/update-resend-provider.md create mode 100644 docs/examples/messaging/update-sendgrid-provider.md create mode 100644 docs/examples/messaging/update-sms.md create mode 100644 docs/examples/messaging/update-smtp-provider.md create mode 100644 docs/examples/messaging/update-telesign-provider.md create mode 100644 docs/examples/messaging/update-textmagic-provider.md create mode 100644 docs/examples/messaging/update-topic.md create mode 100644 docs/examples/messaging/update-twilio-provider.md create mode 100644 docs/examples/messaging/update-vonage-provider.md create mode 100644 docs/examples/project/create-android-platform.md create mode 100644 docs/examples/project/create-apple-platform.md create mode 100644 docs/examples/project/create-ephemeral-key.md create mode 100644 docs/examples/project/create-key.md create mode 100644 docs/examples/project/create-linux-platform.md create mode 100644 docs/examples/project/create-mock-phone.md create mode 100644 docs/examples/project/create-smtp-test.md create mode 100644 docs/examples/project/create-variable.md create mode 100644 docs/examples/project/create-web-platform.md create mode 100644 docs/examples/project/create-windows-platform.md create mode 100644 docs/examples/project/delete-key.md create mode 100644 docs/examples/project/delete-mock-phone.md create mode 100644 docs/examples/project/delete-platform.md create mode 100644 docs/examples/project/delete-variable.md create mode 100644 docs/examples/project/delete.md create mode 100644 docs/examples/project/get-email-template.md create mode 100644 docs/examples/project/get-key.md create mode 100644 docs/examples/project/get-mock-phone.md create mode 100644 docs/examples/project/get-o-auth-2-provider.md create mode 100644 docs/examples/project/get-platform.md create mode 100644 docs/examples/project/get-policy.md create mode 100644 docs/examples/project/get-variable.md create mode 100644 docs/examples/project/list-email-templates.md create mode 100644 docs/examples/project/list-keys.md create mode 100644 docs/examples/project/list-mock-phones.md create mode 100644 docs/examples/project/list-o-auth-2-providers.md create mode 100644 docs/examples/project/list-platforms.md create mode 100644 docs/examples/project/list-policies.md create mode 100644 docs/examples/project/list-variables.md create mode 100644 docs/examples/project/update-android-platform.md create mode 100644 docs/examples/project/update-apple-platform.md create mode 100644 docs/examples/project/update-auth-method.md create mode 100644 docs/examples/project/update-deny-canonical-email-policy.md create mode 100644 docs/examples/project/update-deny-disposable-email-policy.md create mode 100644 docs/examples/project/update-deny-free-email-policy.md create mode 100644 docs/examples/project/update-email-template.md create mode 100644 docs/examples/project/update-key.md create mode 100644 docs/examples/project/update-labels.md create mode 100644 docs/examples/project/update-linux-platform.md create mode 100644 docs/examples/project/update-membership-privacy-policy.md create mode 100644 docs/examples/project/update-mock-phone.md create mode 100644 docs/examples/project/update-o-auth-2-amazon.md create mode 100644 docs/examples/project/update-o-auth-2-apple.md create mode 100644 docs/examples/project/update-o-auth-2-auth-0.md create mode 100644 docs/examples/project/update-o-auth-2-authentik.md create mode 100644 docs/examples/project/update-o-auth-2-autodesk.md create mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md create mode 100644 docs/examples/project/update-o-auth-2-bitly.md create mode 100644 docs/examples/project/update-o-auth-2-box.md create mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md create mode 100644 docs/examples/project/update-o-auth-2-discord.md create mode 100644 docs/examples/project/update-o-auth-2-disqus.md create mode 100644 docs/examples/project/update-o-auth-2-dropbox.md create mode 100644 docs/examples/project/update-o-auth-2-etsy.md create mode 100644 docs/examples/project/update-o-auth-2-facebook.md create mode 100644 docs/examples/project/update-o-auth-2-figma.md create mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md create mode 100644 docs/examples/project/update-o-auth-2-git-hub.md create mode 100644 docs/examples/project/update-o-auth-2-gitlab.md create mode 100644 docs/examples/project/update-o-auth-2-google.md create mode 100644 docs/examples/project/update-o-auth-2-keycloak.md create mode 100644 docs/examples/project/update-o-auth-2-kick.md create mode 100644 docs/examples/project/update-o-auth-2-linkedin.md create mode 100644 docs/examples/project/update-o-auth-2-microsoft.md create mode 100644 docs/examples/project/update-o-auth-2-notion.md create mode 100644 docs/examples/project/update-o-auth-2-oidc.md create mode 100644 docs/examples/project/update-o-auth-2-okta.md create mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-paypal.md create mode 100644 docs/examples/project/update-o-auth-2-podio.md create mode 100644 docs/examples/project/update-o-auth-2-salesforce.md create mode 100644 docs/examples/project/update-o-auth-2-slack.md create mode 100644 docs/examples/project/update-o-auth-2-spotify.md create mode 100644 docs/examples/project/update-o-auth-2-stripe.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md create mode 100644 docs/examples/project/update-o-auth-2-twitch.md create mode 100644 docs/examples/project/update-o-auth-2-word-press.md create mode 100644 docs/examples/project/update-o-auth-2-yahoo.md create mode 100644 docs/examples/project/update-o-auth-2-yandex.md create mode 100644 docs/examples/project/update-o-auth-2-zoho.md create mode 100644 docs/examples/project/update-o-auth-2-zoom.md create mode 100644 docs/examples/project/update-o-auth-2x.md create mode 100644 docs/examples/project/update-password-dictionary-policy.md create mode 100644 docs/examples/project/update-password-history-policy.md create mode 100644 docs/examples/project/update-password-personal-data-policy.md create mode 100644 docs/examples/project/update-protocol.md create mode 100644 docs/examples/project/update-service.md create mode 100644 docs/examples/project/update-session-alert-policy.md create mode 100644 docs/examples/project/update-session-duration-policy.md create mode 100644 docs/examples/project/update-session-invalidation-policy.md create mode 100644 docs/examples/project/update-session-limit-policy.md create mode 100644 docs/examples/project/update-smtp.md create mode 100644 docs/examples/project/update-user-limit-policy.md create mode 100644 docs/examples/project/update-variable.md create mode 100644 docs/examples/project/update-web-platform.md create mode 100644 docs/examples/project/update-windows-platform.md create mode 100644 docs/examples/proxy/create-api-rule.md create mode 100644 docs/examples/proxy/create-function-rule.md create mode 100644 docs/examples/proxy/create-redirect-rule.md create mode 100644 docs/examples/proxy/create-site-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-status.md create mode 100644 docs/examples/sites/create-deployment.md create mode 100644 docs/examples/sites/create-duplicate-deployment.md create mode 100644 docs/examples/sites/create-template-deployment.md create mode 100644 docs/examples/sites/create-variable.md create mode 100644 docs/examples/sites/create-vcs-deployment.md create mode 100644 docs/examples/sites/create.md create mode 100644 docs/examples/sites/delete-deployment.md create mode 100644 docs/examples/sites/delete-log.md create mode 100644 docs/examples/sites/delete-variable.md create mode 100644 docs/examples/sites/delete.md create mode 100644 docs/examples/sites/get-deployment-download.md create mode 100644 docs/examples/sites/get-deployment.md create mode 100644 docs/examples/sites/get-log.md create mode 100644 docs/examples/sites/get-variable.md create mode 100644 docs/examples/sites/get.md create mode 100644 docs/examples/sites/list-deployments.md create mode 100644 docs/examples/sites/list-frameworks.md create mode 100644 docs/examples/sites/list-logs.md create mode 100644 docs/examples/sites/list-specifications.md create mode 100644 docs/examples/sites/list-variables.md create mode 100644 docs/examples/sites/list.md create mode 100644 docs/examples/sites/update-deployment-status.md create mode 100644 docs/examples/sites/update-site-deployment.md create mode 100644 docs/examples/sites/update-variable.md create mode 100644 docs/examples/sites/update.md create mode 100644 docs/examples/storage/create-bucket.md create mode 100644 docs/examples/storage/delete-bucket.md create mode 100644 docs/examples/storage/get-bucket.md create mode 100644 docs/examples/storage/list-buckets.md create mode 100644 docs/examples/storage/update-bucket.md create mode 100644 docs/examples/tablesdb/create-big-int-column.md create mode 100644 docs/examples/tablesdb/create-boolean-column.md create mode 100644 docs/examples/tablesdb/create-datetime-column.md create mode 100644 docs/examples/tablesdb/create-email-column.md create mode 100644 docs/examples/tablesdb/create-enum-column.md create mode 100644 docs/examples/tablesdb/create-float-column.md create mode 100644 docs/examples/tablesdb/create-index.md create mode 100644 docs/examples/tablesdb/create-integer-column.md create mode 100644 docs/examples/tablesdb/create-ip-column.md create mode 100644 docs/examples/tablesdb/create-line-column.md create mode 100644 docs/examples/tablesdb/create-longtext-column.md create mode 100644 docs/examples/tablesdb/create-mediumtext-column.md create mode 100644 docs/examples/tablesdb/create-point-column.md create mode 100644 docs/examples/tablesdb/create-polygon-column.md create mode 100644 docs/examples/tablesdb/create-relationship-column.md create mode 100644 docs/examples/tablesdb/create-rows.md create mode 100644 docs/examples/tablesdb/create-string-column.md create mode 100644 docs/examples/tablesdb/create-table.md create mode 100644 docs/examples/tablesdb/create-text-column.md create mode 100644 docs/examples/tablesdb/create-url-column.md create mode 100644 docs/examples/tablesdb/create-varchar-column.md create mode 100644 docs/examples/tablesdb/create.md create mode 100644 docs/examples/tablesdb/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.md create mode 100644 docs/examples/tablesdb/delete-rows.md create mode 100644 docs/examples/tablesdb/delete-table.md create mode 100644 docs/examples/tablesdb/delete.md create mode 100644 docs/examples/tablesdb/get-column.md create mode 100644 docs/examples/tablesdb/get-index.md create mode 100644 docs/examples/tablesdb/get-table.md create mode 100644 docs/examples/tablesdb/get.md create mode 100644 docs/examples/tablesdb/list-columns.md create mode 100644 docs/examples/tablesdb/list-indexes.md create mode 100644 docs/examples/tablesdb/list-tables.md create mode 100644 docs/examples/tablesdb/list.md create mode 100644 docs/examples/tablesdb/update-big-int-column.md create mode 100644 docs/examples/tablesdb/update-boolean-column.md create mode 100644 docs/examples/tablesdb/update-datetime-column.md create mode 100644 docs/examples/tablesdb/update-email-column.md create mode 100644 docs/examples/tablesdb/update-enum-column.md create mode 100644 docs/examples/tablesdb/update-float-column.md create mode 100644 docs/examples/tablesdb/update-integer-column.md create mode 100644 docs/examples/tablesdb/update-ip-column.md create mode 100644 docs/examples/tablesdb/update-line-column.md create mode 100644 docs/examples/tablesdb/update-longtext-column.md create mode 100644 docs/examples/tablesdb/update-mediumtext-column.md create mode 100644 docs/examples/tablesdb/update-point-column.md create mode 100644 docs/examples/tablesdb/update-polygon-column.md create mode 100644 docs/examples/tablesdb/update-relationship-column.md create mode 100644 docs/examples/tablesdb/update-rows.md create mode 100644 docs/examples/tablesdb/update-string-column.md create mode 100644 docs/examples/tablesdb/update-table.md create mode 100644 docs/examples/tablesdb/update-text-column.md create mode 100644 docs/examples/tablesdb/update-url-column.md create mode 100644 docs/examples/tablesdb/update-varchar-column.md create mode 100644 docs/examples/tablesdb/update.md create mode 100644 docs/examples/tablesdb/upsert-rows.md create mode 100644 docs/examples/tokens/create-file-token.md create mode 100644 docs/examples/tokens/delete.md create mode 100644 docs/examples/tokens/get.md create mode 100644 docs/examples/tokens/list.md create mode 100644 docs/examples/tokens/update.md create mode 100644 docs/examples/users/create-argon-2-user.md create mode 100644 docs/examples/users/create-bcrypt-user.md create mode 100644 docs/examples/users/create-jwt.md create mode 100644 docs/examples/users/create-md-5-user.md create mode 100644 docs/examples/users/create-mfa-recovery-codes.md create mode 100644 docs/examples/users/create-ph-pass-user.md create mode 100644 docs/examples/users/create-scrypt-modified-user.md create mode 100644 docs/examples/users/create-scrypt-user.md create mode 100644 docs/examples/users/create-session.md create mode 100644 docs/examples/users/create-sha-user.md create mode 100644 docs/examples/users/create-target.md create mode 100644 docs/examples/users/create-token.md create mode 100644 docs/examples/users/create.md create mode 100644 docs/examples/users/delete-identity.md create mode 100644 docs/examples/users/delete-mfa-authenticator.md create mode 100644 docs/examples/users/delete-session.md create mode 100644 docs/examples/users/delete-sessions.md create mode 100644 docs/examples/users/delete-target.md create mode 100644 docs/examples/users/delete.md create mode 100644 docs/examples/users/get-mfa-recovery-codes.md create mode 100644 docs/examples/users/get-prefs.md create mode 100644 docs/examples/users/get-target.md create mode 100644 docs/examples/users/get.md create mode 100644 docs/examples/users/list-identities.md create mode 100644 docs/examples/users/list-logs.md create mode 100644 docs/examples/users/list-memberships.md create mode 100644 docs/examples/users/list-mfa-factors.md create mode 100644 docs/examples/users/list-sessions.md create mode 100644 docs/examples/users/list-targets.md create mode 100644 docs/examples/users/list.md create mode 100644 docs/examples/users/update-email-verification.md create mode 100644 docs/examples/users/update-email.md create mode 100644 docs/examples/users/update-impersonator.md create mode 100644 docs/examples/users/update-labels.md create mode 100644 docs/examples/users/update-mfa-recovery-codes.md create mode 100644 docs/examples/users/update-mfa.md create mode 100644 docs/examples/users/update-name.md create mode 100644 docs/examples/users/update-password.md create mode 100644 docs/examples/users/update-phone-verification.md create mode 100644 docs/examples/users/update-phone.md create mode 100644 docs/examples/users/update-prefs.md create mode 100644 docs/examples/users/update-status.md create mode 100644 docs/examples/users/update-target.md create mode 100644 docs/examples/webhooks/create.md create mode 100644 docs/examples/webhooks/delete.md create mode 100644 docs/examples/webhooks/get.md create mode 100644 docs/examples/webhooks/list.md create mode 100644 docs/examples/webhooks/update-secret.md create mode 100644 docs/examples/webhooks/update.md create mode 100644 src/enums/adapter.ts create mode 100644 src/enums/attribute-status.ts create mode 100644 src/enums/auth-method.ts create mode 100644 src/enums/backup-services.ts create mode 100644 src/enums/build-runtime.ts create mode 100644 src/enums/column-status.ts create mode 100644 src/enums/compression.ts create mode 100644 src/enums/database-type.ts create mode 100644 src/enums/databases-index-type.ts create mode 100644 src/enums/deployment-download-type.ts create mode 100644 src/enums/deployment-status.ts create mode 100644 src/enums/email-template-locale.ts create mode 100644 src/enums/email-template-type.ts create mode 100644 src/enums/framework.ts create mode 100644 src/enums/health-antivirus-status.ts create mode 100644 src/enums/health-check-status.ts create mode 100644 src/enums/index-status.ts create mode 100644 src/enums/message-priority.ts create mode 100644 src/enums/message-status.ts create mode 100644 src/enums/messaging-provider-type.ts create mode 100644 src/enums/name.ts create mode 100644 src/enums/o-auth-2-google-prompt.ts create mode 100644 src/enums/order-by.ts create mode 100644 src/enums/password-hash.ts create mode 100644 src/enums/platform-type.ts create mode 100644 src/enums/project-policy.ts create mode 100644 src/enums/prompt.ts create mode 100644 src/enums/protocol-id.ts create mode 100644 src/enums/proxy-resource-type.ts create mode 100644 src/enums/proxy-rule-deployment-resource-type.ts create mode 100644 src/enums/proxy-rule-status.ts create mode 100644 src/enums/relation-mutate.ts create mode 100644 src/enums/relationship-type.ts create mode 100644 src/enums/runtime.ts create mode 100644 src/enums/scopes.ts create mode 100644 src/enums/secure.ts create mode 100644 src/enums/service-id.ts create mode 100644 src/enums/smtp-encryption.ts create mode 100644 src/enums/status-code.ts create mode 100644 src/enums/tables-db-index-type.ts create mode 100644 src/enums/template-reference-type.ts create mode 100644 src/enums/vcs-reference-type.ts create mode 100644 src/services/activities.ts create mode 100644 src/services/backups.ts create mode 100644 src/services/health.ts create mode 100644 src/services/project.ts create mode 100644 src/services/proxy.ts create mode 100644 src/services/sites.ts create mode 100644 src/services/tokens.ts create mode 100644 src/services/users.ts create mode 100644 src/services/webhooks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a81e13..d115a2c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,15 @@ # Change Log -## 25.1.0 - -* Added: Added `setCookie()` method to `Client` for forwarding incoming `Cookie` headers in server-side runtimes -* Added: Added `Fusionauth`, `Keycloak`, and `Kick` OAuth providers to `OAuthProvider` enum -* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.4` +## 26.0.0 + +* Breaking: Web SDK now generated from the server API spec; package exposes the full server-side service surface (`Users`, `Projects`, `Functions` admin endpoints, `Sites`, `Health`, `Proxy`, `Webhooks`, `Backups`, `Activities`, `Tokens`) in addition to the existing client services +* Added: Isomorphic `Client.from()`, `Client.fromSession()`, `Client.fromAPIKey()`, `Client.fromCookie()`, `Client.fromJWT()`, `Client.fromDevKey()`, and `Client.fromImpersonation()` static factories for use in both browser and server runtimes +* Added: `setCookie()` method on `Client` for forwarding cookies from server runtimes +* Added: `prompt` parameter on `Project.updateOAuth2Google()` plus `Prompt` and `OAuth2GooglePrompt` enums +* Added: `Project.updateDenyCanonicalEmailPolicy()`, `Project.updateDenyDisposableEmailPolicy()`, `Project.updateDenyFreeEmailPolicy()` +* Added: `fusionauth`, `keycloak`, and `kick` to `OAuthProvider` enum +* Updated: `X-Appwrite-Response-Format` header to `1.9.4` +* Updated: `BuildRuntime` and `Runtime` enums with `deno-1.21`, `deno-1.24`, `deno-1.35` ## 25.0.0 diff --git a/README.md b/README.md index d52114f0..4a8ec0aa 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 818f50a4..d7df4a9f 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 4010b91f..b825eab9 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 940a7f70..d220d8a0 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index a3e378d2..b656e027 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 0ba2d266..4d75ed92 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 59d1aaf0..5b7a3f78 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index cf6a6098..ceaf306b 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -3,7 +3,8 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index d9d9856d..ee23dcc2 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -3,7 +3,8 @@ import { Client, Account, AuthenticationFactor } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 3c292f26..e2cf3146 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index f6187249..9c17d4b7 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -3,7 +3,8 @@ import { Client, Account, OAuthProvider } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 78812e33..284b8078 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 9c0ea143..8b862715 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 0f4e7a91..6448093f 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 1639c12c..5d7d8be6 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 0795d0ac..8e983ef0 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index a78197cd..55d2b261 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index d63addb7..6c2ae43f 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 079f0b95..5d51b800 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -3,7 +3,8 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9d2b8f3e..c42412bd 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index d7df883e..17e829fa 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 1d102583..324dda73 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 9e2d5e25..216f3337 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 83ac4b0a..5992c100 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 0b6c59e3..89021c15 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 8dee4b39..87b664ae 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 91be728f..c2097ec1 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 9950129b..be51706f 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 2dae7488..a7eab3f0 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index f3e8b619..33cbbeb6 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 0bd7d36c..d328a939 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index d0598719..faba9344 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index bf25c76b..a71308fc 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -3,7 +3,8 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index a16ea43a..a44a9954 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 8bc8273c..dd88f692 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index f17ca2b1..cea7b2ae 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 3e184d75..305118df 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 360c577f..abb7d066 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 5352cf0a..704b934e 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 2ddd0f13..8125dd7a 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 9f640a12..e46a27aa 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ca2841b7..0ccc64ba 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index e08d48cb..5eec4923 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 9159580f..3324081c 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index ac2aa48e..c8aab7ab 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 3b52a83c..3364d117 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -3,7 +3,8 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const account = new Account(client); diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md new file mode 100644 index 00000000..f6c2fb28 --- /dev/null +++ b/docs/examples/activities/get-event.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Activities } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const activities = new Activities(client); + +const result = await activities.getEvent({ + eventId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md new file mode 100644 index 00000000..0ca7f5fe --- /dev/null +++ b/docs/examples/activities/list-events.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Activities } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const activities = new Activities(client); + +const result = await activities.listEvents({ + queries: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index d4c1a40f..69da700f 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -3,7 +3,8 @@ import { Client, Avatars, Browser } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 57758501..f0d07fae 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -3,7 +3,8 @@ import { Client, Avatars, CreditCard } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 8b09f65f..8f9831e7 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -3,7 +3,8 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index d24b9b40..2460f36c 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -3,7 +3,8 @@ import { Client, Avatars, Flag } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index f8f33731..d0fee491 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -3,7 +3,8 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 0722a72d..c038261a 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -3,7 +3,8 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index 829c7121..e7ad12c1 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -3,7 +3,8 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 8804b1e8..37752c17 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -3,7 +3,8 @@ import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const avatars = new Avatars(client); diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 00000000..cd437957 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.createArchive({ + services: [BackupServices.Databases], + resourceId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 00000000..0c4d48c9 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.createPolicy({ + policyId: '', + services: [BackupServices.Databases], + retention: 1, + schedule: '', + name: '', // optional + resourceId: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 00000000..9e4f05f8 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.createRestoration({ + archiveId: '', + services: [BackupServices.Databases], + newResourceId: '', // optional + newResourceName: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 00000000..6bcd50e5 --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.deleteArchive({ + archiveId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 00000000..f94cecc5 --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.deletePolicy({ + policyId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 00000000..13a6bf8b --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.getArchive({ + archiveId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 00000000..33f8e829 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.getPolicy({ + policyId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 00000000..9638a222 --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.getRestoration({ + restorationId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 00000000..42bd8418 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.listArchives({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 00000000..cb4fb20a --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.listPolicies({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 00000000..9b10280d --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.listRestorations({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 00000000..c8dfb9c0 --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const backups = new Backups(client); + +const result = await backups.updatePolicy({ + policyId: '', + name: '', // optional + retention: 1, // optional + schedule: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..5211fbb7 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md new file mode 100644 index 00000000..22db05b0 --- /dev/null +++ b/docs/examples/databases/create-boolean-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createBooleanAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md new file mode 100644 index 00000000..b10f661a --- /dev/null +++ b/docs/examples/databases/create-collection.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createCollection({ + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission.read(Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md new file mode 100644 index 00000000..07da4465 --- /dev/null +++ b/docs/examples/databases/create-datetime-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createDatetimeAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 4d8d7f90..d7f5d94a 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,7 +3,8 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md new file mode 100644 index 00000000..f25f9065 --- /dev/null +++ b/docs/examples/databases/create-documents.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createDocuments({ + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md new file mode 100644 index 00000000..7e131f87 --- /dev/null +++ b/docs/examples/databases/create-email-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createEmailAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md new file mode 100644 index 00000000..9a8c23ed --- /dev/null +++ b/docs/examples/databases/create-enum-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createEnumAttribute({ + databaseId: '', + collectionId: '', + key: '', + elements: [], + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md new file mode 100644 index 00000000..8b2a5372 --- /dev/null +++ b/docs/examples/databases/create-float-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createFloatAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md new file mode 100644 index 00000000..dfba1599 --- /dev/null +++ b/docs/examples/databases/create-index.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases, DatabasesIndexType, OrderBy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createIndex({ + databaseId: '', + collectionId: '', + key: '', + type: DatabasesIndexType.Key, + attributes: [], + orders: [OrderBy.Asc], // optional + lengths: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md new file mode 100644 index 00000000..fbc15919 --- /dev/null +++ b/docs/examples/databases/create-integer-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createIntegerAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md new file mode 100644 index 00000000..7a368a9d --- /dev/null +++ b/docs/examples/databases/create-ip-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createIpAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 00000000..4dbb91db --- /dev/null +++ b/docs/examples/databases/create-line-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createLineAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 00000000..4bbb6f48 --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 00000000..e8e72cec --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 48c74718..6aba1cf7 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md new file mode 100644 index 00000000..ae001017 --- /dev/null +++ b/docs/examples/databases/create-point-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createPointAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [1, 2] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md new file mode 100644 index 00000000..cc4ca0b0 --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createPolygonAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md new file mode 100644 index 00000000..638d097c --- /dev/null +++ b/docs/examples/databases/create-relationship-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases, RelationshipType, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createRelationshipAttribute({ + databaseId: '', + collectionId: '', + relatedCollectionId: '', + type: RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate.Cascade // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md new file mode 100644 index 00000000..f542d718 --- /dev/null +++ b/docs/examples/databases/create-string-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createStringAttribute({ + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 00000000..66275d52 --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index eab2aa52..4c5265cb 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md new file mode 100644 index 00000000..db970a9e --- /dev/null +++ b/docs/examples/databases/create-url-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createUrlAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 00000000..fede13c8 --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.createVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md new file mode 100644 index 00000000..996365e2 --- /dev/null +++ b/docs/examples/databases/create.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.create({ + databaseId: '', + name: '', + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index c657bd49..739859a0 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md new file mode 100644 index 00000000..eb426f88 --- /dev/null +++ b/docs/examples/databases/delete-attribute.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.deleteAttribute({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md new file mode 100644 index 00000000..6a77b190 --- /dev/null +++ b/docs/examples/databases/delete-collection.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.deleteCollection({ + databaseId: '', + collectionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 95665088..a7c963ec 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md new file mode 100644 index 00000000..1d164615 --- /dev/null +++ b/docs/examples/databases/delete-documents.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.deleteDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md new file mode 100644 index 00000000..cd181aba --- /dev/null +++ b/docs/examples/databases/delete-index.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.deleteIndex({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index 2e41d9be..cdbccd4b 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md new file mode 100644 index 00000000..00477de2 --- /dev/null +++ b/docs/examples/databases/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.delete({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md new file mode 100644 index 00000000..6d3620b1 --- /dev/null +++ b/docs/examples/databases/get-attribute.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.getAttribute({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md new file mode 100644 index 00000000..537e15b5 --- /dev/null +++ b/docs/examples/databases/get-collection.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.getCollection({ + databaseId: '', + collectionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index ad11eb8d..5efbd4c7 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md new file mode 100644 index 00000000..3dbd33bb --- /dev/null +++ b/docs/examples/databases/get-index.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.getIndex({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 2419a8c0..766821f1 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md new file mode 100644 index 00000000..c15844bf --- /dev/null +++ b/docs/examples/databases/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.get({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 51eec6d5..b8379897 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md new file mode 100644 index 00000000..a1990ca1 --- /dev/null +++ b/docs/examples/databases/list-attributes.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.listAttributes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md new file mode 100644 index 00000000..d1d68782 --- /dev/null +++ b/docs/examples/databases/list-collections.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.listCollections({ + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 5444dffb..947814e1 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md new file mode 100644 index 00000000..3dfb00b3 --- /dev/null +++ b/docs/examples/databases/list-indexes.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.listIndexes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 6a74afc0..a8742d63 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md new file mode 100644 index 00000000..b6880df9 --- /dev/null +++ b/docs/examples/databases/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.list({ + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..f2963c74 --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md new file mode 100644 index 00000000..6f778dc7 --- /dev/null +++ b/docs/examples/databases/update-boolean-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateBooleanAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md new file mode 100644 index 00000000..66cb382f --- /dev/null +++ b/docs/examples/databases/update-collection.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateCollection({ + databaseId: '', + collectionId: '', + name: '', // optional + permissions: [Permission.read(Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md new file mode 100644 index 00000000..19a99e27 --- /dev/null +++ b/docs/examples/databases/update-datetime-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateDatetimeAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index df5651d8..8421a7cd 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -3,7 +3,8 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md new file mode 100644 index 00000000..ec49e33e --- /dev/null +++ b/docs/examples/databases/update-documents.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateDocuments({ + databaseId: '', + collectionId: '', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + queries: [], // optional + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md new file mode 100644 index 00000000..e93167bb --- /dev/null +++ b/docs/examples/databases/update-email-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateEmailAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md new file mode 100644 index 00000000..4c8b47cb --- /dev/null +++ b/docs/examples/databases/update-enum-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateEnumAttribute({ + databaseId: '', + collectionId: '', + key: '', + elements: [], + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md new file mode 100644 index 00000000..02965892 --- /dev/null +++ b/docs/examples/databases/update-float-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateFloatAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md new file mode 100644 index 00000000..93e12509 --- /dev/null +++ b/docs/examples/databases/update-integer-attribute.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateIntegerAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md new file mode 100644 index 00000000..7a6c9298 --- /dev/null +++ b/docs/examples/databases/update-ip-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateIpAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md new file mode 100644 index 00000000..2c0e8b00 --- /dev/null +++ b/docs/examples/databases/update-line-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateLineAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 00000000..af9fe747 --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 00000000..0203e6cc --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md new file mode 100644 index 00000000..f53faa5c --- /dev/null +++ b/docs/examples/databases/update-point-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updatePointAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md new file mode 100644 index 00000000..bf3b4acc --- /dev/null +++ b/docs/examples/databases/update-polygon-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updatePolygonAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md new file mode 100644 index 00000000..05951b5a --- /dev/null +++ b/docs/examples/databases/update-relationship-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateRelationshipAttribute({ + databaseId: '', + collectionId: '', + key: '', + onDelete: RelationMutate.Cascade, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md new file mode 100644 index 00000000..f4495fcb --- /dev/null +++ b/docs/examples/databases/update-string-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateStringAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 00000000..4a5dee9c --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 5a50ef67..1e068b9c 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -3,7 +3,8 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const databases = new Databases(client); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md new file mode 100644 index 00000000..efc001e8 --- /dev/null +++ b/docs/examples/databases/update-url-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateUrlAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 00000000..a72de3a6 --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.updateVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md new file mode 100644 index 00000000..a3274f23 --- /dev/null +++ b/docs/examples/databases/update.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.update({ + databaseId: '', + name: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 212964a6..47e384eb 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -3,7 +3,8 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new Databases(client); diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md new file mode 100644 index 00000000..a21a7823 --- /dev/null +++ b/docs/examples/databases/upsert-documents.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new Databases(client); + +const result = await databases.upsertDocuments({ + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md new file mode 100644 index 00000000..c1e9e899 --- /dev/null +++ b/docs/examples/functions/create-deployment.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.createDeployment({ + functionId: '', + code: document.getElementById('uploader').files[0], + activate: false, + entrypoint: '', // optional + commands: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md new file mode 100644 index 00000000..fc071792 --- /dev/null +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.createDuplicateDeployment({ + functionId: '', + deploymentId: '', + buildId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 29241151..dd1d9c2b 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -3,7 +3,8 @@ import { Client, Functions, ExecutionMethod } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const functions = new Functions(client); @@ -11,7 +12,7 @@ const result = await functions.createExecution({ functionId: '', body: '', // optional async: false, // optional - path: '', // optional + xpath: '', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '' // optional diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md new file mode 100644 index 00000000..644459b7 --- /dev/null +++ b/docs/examples/functions/create-template-deployment.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Functions, TemplateReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.createTemplateDeployment({ + functionId: '', + repository: '', + owner: '', + rootDirectory: '', + type: TemplateReferenceType.Commit, + reference: '', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md new file mode 100644 index 00000000..2046356e --- /dev/null +++ b/docs/examples/functions/create-variable.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.createVariable({ + functionId: '', + variableId: '', + key: '', + value: '', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md new file mode 100644 index 00000000..5ab2bd02 --- /dev/null +++ b/docs/examples/functions/create-vcs-deployment.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Functions, VCSReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.createVcsDeployment({ + functionId: '', + type: VCSReferenceType.Branch, + reference: '', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md new file mode 100644 index 00000000..914637c0 --- /dev/null +++ b/docs/examples/functions/create.md @@ -0,0 +1,35 @@ +```javascript +import { Client, Functions, Runtime, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.create({ + functionId: '', + name: '', + runtime: Runtime.Node145, + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '', // optional + commands: '', // optional + scopes: [Scopes.ProjectRead], // optional + installationId: '', // optional + providerRepositoryId: '', // optional + providerBranch: '', // optional + providerSilentMode: false, // optional + providerRootDirectory: '', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md new file mode 100644 index 00000000..188ca62d --- /dev/null +++ b/docs/examples/functions/delete-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.deleteDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md new file mode 100644 index 00000000..0f175e35 --- /dev/null +++ b/docs/examples/functions/delete-execution.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.deleteExecution({ + functionId: '', + executionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md new file mode 100644 index 00000000..ac367b34 --- /dev/null +++ b/docs/examples/functions/delete-variable.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.deleteVariable({ + functionId: '', + variableId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md new file mode 100644 index 00000000..1fe83049 --- /dev/null +++ b/docs/examples/functions/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.delete({ + functionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md new file mode 100644 index 00000000..3bfcbf6f --- /dev/null +++ b/docs/examples/functions/get-deployment-download.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions, DeploymentDownloadType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = functions.getDeploymentDownload({ + functionId: '', + deploymentId: '', + type: DeploymentDownloadType.Source // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md new file mode 100644 index 00000000..c200162e --- /dev/null +++ b/docs/examples/functions/get-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.getDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index a9b22e29..14839a09 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -3,7 +3,8 @@ import { Client, Functions } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const functions = new Functions(client); diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md new file mode 100644 index 00000000..2e78c6a5 --- /dev/null +++ b/docs/examples/functions/get-variable.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.getVariable({ + functionId: '', + variableId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md new file mode 100644 index 00000000..d430fec6 --- /dev/null +++ b/docs/examples/functions/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.get({ + functionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md new file mode 100644 index 00000000..e83ea6f6 --- /dev/null +++ b/docs/examples/functions/list-deployments.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.listDeployments({ + functionId: '', + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 55aa3cb7..6f021c4f 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -3,7 +3,8 @@ import { Client, Functions } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const functions = new Functions(client); diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md new file mode 100644 index 00000000..c10e3ecc --- /dev/null +++ b/docs/examples/functions/list-runtimes.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.listRuntimes(); + +console.log(result); +``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md new file mode 100644 index 00000000..060a7193 --- /dev/null +++ b/docs/examples/functions/list-specifications.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.listSpecifications(); + +console.log(result); +``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md new file mode 100644 index 00000000..21321205 --- /dev/null +++ b/docs/examples/functions/list-variables.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.listVariables({ + functionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md new file mode 100644 index 00000000..6cc31f59 --- /dev/null +++ b/docs/examples/functions/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.list({ + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md new file mode 100644 index 00000000..9d6aa151 --- /dev/null +++ b/docs/examples/functions/update-deployment-status.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.updateDeploymentStatus({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md new file mode 100644 index 00000000..39479dee --- /dev/null +++ b/docs/examples/functions/update-function-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.updateFunctionDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md new file mode 100644 index 00000000..f1c7c694 --- /dev/null +++ b/docs/examples/functions/update-variable.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.updateVariable({ + functionId: '', + variableId: '', + key: '', // optional + value: '', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md new file mode 100644 index 00000000..0900fc5b --- /dev/null +++ b/docs/examples/functions/update.md @@ -0,0 +1,35 @@ +```javascript +import { Client, Functions, Runtime, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const functions = new Functions(client); + +const result = await functions.update({ + functionId: '', + name: '', + runtime: Runtime.Node145, // optional + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '', // optional + commands: '', // optional + scopes: [Scopes.ProjectRead], // optional + installationId: '', // optional + providerRepositoryId: '', // optional + providerBranch: '', // optional + providerSilentMode: false, // optional + providerRootDirectory: '', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index a0230ef6..979a108d 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -3,7 +3,8 @@ import { Client, Graphql } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const graphql = new Graphql(client); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index bef786ab..62f27815 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -3,7 +3,8 @@ import { Client, Graphql } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setKey(''); // Your secret API key const graphql = new Graphql(client); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md new file mode 100644 index 00000000..b6cc3299 --- /dev/null +++ b/docs/examples/health/get-antivirus.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getAntivirus(); + +console.log(result); +``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md new file mode 100644 index 00000000..9f0bafbb --- /dev/null +++ b/docs/examples/health/get-cache.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getCache(); + +console.log(result); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md new file mode 100644 index 00000000..a5764407 --- /dev/null +++ b/docs/examples/health/get-certificate.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getCertificate({ + domain: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..7bc69ea4 --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getConsolePausing({ + threshold: null, // optional + inactivityDays: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md new file mode 100644 index 00000000..ae3a9d51 --- /dev/null +++ b/docs/examples/health/get-db.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getDB(); + +console.log(result); +``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md new file mode 100644 index 00000000..0c77a73c --- /dev/null +++ b/docs/examples/health/get-failed-jobs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Health, Name } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getFailedJobs({ + name: Name.V1Database, + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 00000000..d77916b4 --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getPubSub(); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 00000000..1ad7f4e9 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueAudits({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md new file mode 100644 index 00000000..73cc7693 --- /dev/null +++ b/docs/examples/health/get-queue-builds.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueBuilds({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md new file mode 100644 index 00000000..7c6e56e1 --- /dev/null +++ b/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueCertificates({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md new file mode 100644 index 00000000..2cf4d769 --- /dev/null +++ b/docs/examples/health/get-queue-databases.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueDatabases({ + name: '', // optional + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md new file mode 100644 index 00000000..bdf63c75 --- /dev/null +++ b/docs/examples/health/get-queue-deletes.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueDeletes({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md new file mode 100644 index 00000000..e140e4d1 --- /dev/null +++ b/docs/examples/health/get-queue-functions.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueFunctions({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md new file mode 100644 index 00000000..61d4457a --- /dev/null +++ b/docs/examples/health/get-queue-logs.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueLogs({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md new file mode 100644 index 00000000..5d327c99 --- /dev/null +++ b/docs/examples/health/get-queue-mails.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueMails({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md new file mode 100644 index 00000000..5705d9e5 --- /dev/null +++ b/docs/examples/health/get-queue-messaging.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueMessaging({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md new file mode 100644 index 00000000..16a6aa37 --- /dev/null +++ b/docs/examples/health/get-queue-migrations.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueMigrations({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md new file mode 100644 index 00000000..b3eaec8e --- /dev/null +++ b/docs/examples/health/get-queue-stats-resources.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueStatsResources({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md new file mode 100644 index 00000000..d6642e88 --- /dev/null +++ b/docs/examples/health/get-queue-usage.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueUsage({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 00000000..9caa23eb --- /dev/null +++ b/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getQueueWebhooks({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md new file mode 100644 index 00000000..d8635c01 --- /dev/null +++ b/docs/examples/health/get-storage-local.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getStorageLocal(); + +console.log(result); +``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md new file mode 100644 index 00000000..8dfa152a --- /dev/null +++ b/docs/examples/health/get-storage.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getStorage(); + +console.log(result); +``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md new file mode 100644 index 00000000..b5a5d99e --- /dev/null +++ b/docs/examples/health/get-time.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.getTime(); + +console.log(result); +``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md new file mode 100644 index 00000000..b146a5cc --- /dev/null +++ b/docs/examples/health/get.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new Health(client); + +const result = await health.get(); + +console.log(result); +``` diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 95e92c4c..20035e4f 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index d6e9d33b..e00ac0e8 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 6af2b7f4..beadd6e8 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 92b3fa08..647a2864 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 517a19a3..ba27ba71 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index f92f9985..4f4306e6 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 50c0f222..46aed9cc 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index a3afe001..57e5ee15 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -3,7 +3,8 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const locale = new Locale(client); diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 00000000..1d1f985f --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createAPNSProvider({ + providerId: '', + name: '', + authKey: '', // optional + authKeyId: '', // optional + teamId: '', // optional + bundleId: '', // optional + sandbox: false, // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md new file mode 100644 index 00000000..cd8c26ec --- /dev/null +++ b/docs/examples/messaging/create-email.md @@ -0,0 +1,27 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createEmail({ + messageId: '', + subject: '', + content: '', + topics: [], // optional + users: [], // optional + targets: [], // optional + cc: [], // optional + bcc: [], // optional + attachments: [], // optional + draft: false, // optional + html: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 00000000..86b2608b --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createFCMProvider({ + providerId: '', + name: '', + serviceAccountJSON: {}, // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 00000000..9eb7464b --- /dev/null +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createMailgunProvider({ + providerId: '', + name: '', + apiKey: '', // optional + domain: '', // optional + isEuRegion: false, // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md new file mode 100644 index 00000000..db002142 --- /dev/null +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createMsg91Provider({ + providerId: '', + name: '', + templateId: '', // optional + senderId: '', // optional + authKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md new file mode 100644 index 00000000..d14b1d47 --- /dev/null +++ b/docs/examples/messaging/create-push.md @@ -0,0 +1,34 @@ +```javascript +import { Client, Messaging, MessagePriority } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createPush({ + messageId: '', + title: '', // optional + body: '<BODY>', // optional + topics: [], // optional + users: [], // optional + targets: [], // optional + data: {}, // optional + action: '<ACTION>', // optional + image: '<ID1:ID2>', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority.Normal // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md new file mode 100644 index 00000000..dae8c132 --- /dev/null +++ b/docs/examples/messaging/create-resend-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createResendProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 00000000..904505df --- /dev/null +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createSendgridProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 00000000..e3a528d1 --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createSMS({ + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 00000000..7d723827 --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,29 @@ +```javascript +import { Client, Messaging, SmtpEncryption } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createSMTPProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index c29c2f71..6106649d 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -3,7 +3,8 @@ import { Client, Messaging } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token const messaging = new Messaging(client); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md new file mode 100644 index 00000000..1b4a133b --- /dev/null +++ b/docs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createTelesignProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 00000000..83852c55 --- /dev/null +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createTextmagicProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md new file mode 100644 index 00000000..e64f0fdb --- /dev/null +++ b/docs/examples/messaging/create-topic.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md new file mode 100644 index 00000000..76238497 --- /dev/null +++ b/docs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createTwilioProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md new file mode 100644 index 00000000..91ffd288 --- /dev/null +++ b/docs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.createVonageProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md new file mode 100644 index 00000000..d822d08b --- /dev/null +++ b/docs/examples/messaging/delete-provider.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.deleteProvider({ + providerId: '<PROVIDER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index acd0be51..2eee3367 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -3,7 +3,8 @@ import { Client, Messaging } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token const messaging = new Messaging(client); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md new file mode 100644 index 00000000..8d93de2f --- /dev/null +++ b/docs/examples/messaging/delete-topic.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.deleteTopic({ + topicId: '<TOPIC_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md new file mode 100644 index 00000000..d9022c37 --- /dev/null +++ b/docs/examples/messaging/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.delete({ + messageId: '<MESSAGE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md new file mode 100644 index 00000000..7f92930f --- /dev/null +++ b/docs/examples/messaging/get-message.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.getMessage({ + messageId: '<MESSAGE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md new file mode 100644 index 00000000..4375fc3c --- /dev/null +++ b/docs/examples/messaging/get-provider.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.getProvider({ + providerId: '<PROVIDER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md new file mode 100644 index 00000000..daa3294d --- /dev/null +++ b/docs/examples/messaging/get-subscriber.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.getSubscriber({ + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md new file mode 100644 index 00000000..025f874f --- /dev/null +++ b/docs/examples/messaging/get-topic.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.getTopic({ + topicId: '<TOPIC_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md new file mode 100644 index 00000000..887d4e3a --- /dev/null +++ b/docs/examples/messaging/list-message-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listMessageLogs({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md new file mode 100644 index 00000000..5e2cfc43 --- /dev/null +++ b/docs/examples/messaging/list-messages.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listMessages({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md new file mode 100644 index 00000000..f8dab61b --- /dev/null +++ b/docs/examples/messaging/list-provider-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listProviderLogs({ + providerId: '<PROVIDER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md new file mode 100644 index 00000000..010bd9af --- /dev/null +++ b/docs/examples/messaging/list-providers.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listProviders({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 00000000..addd6f35 --- /dev/null +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listSubscriberLogs({ + subscriberId: '<SUBSCRIBER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md new file mode 100644 index 00000000..eb73937d --- /dev/null +++ b/docs/examples/messaging/list-subscribers.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listSubscribers({ + topicId: '<TOPIC_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md new file mode 100644 index 00000000..528131a0 --- /dev/null +++ b/docs/examples/messaging/list-targets.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listTargets({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md new file mode 100644 index 00000000..0fa825c7 --- /dev/null +++ b/docs/examples/messaging/list-topic-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listTopicLogs({ + topicId: '<TOPIC_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md new file mode 100644 index 00000000..51d10b0b --- /dev/null +++ b/docs/examples/messaging/list-topics.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.listTopics({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md new file mode 100644 index 00000000..45b1d6e1 --- /dev/null +++ b/docs/examples/messaging/update-apns-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateAPNSProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md new file mode 100644 index 00000000..c56e78c0 --- /dev/null +++ b/docs/examples/messaging/update-email.md @@ -0,0 +1,27 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateEmail({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + subject: '<SUBJECT>', // optional + content: '<CONTENT>', // optional + draft: false, // optional + html: false, // optional + cc: [], // optional + bcc: [], // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + attachments: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md new file mode 100644 index 00000000..392f2c76 --- /dev/null +++ b/docs/examples/messaging/update-fcm-provider.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateFCMProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + serviceAccountJSON: {} // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 00000000..2eed0f2e --- /dev/null +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateMailgunProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md new file mode 100644 index 00000000..1f5485bc --- /dev/null +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateMsg91Provider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md new file mode 100644 index 00000000..0eee4147 --- /dev/null +++ b/docs/examples/messaging/update-push.md @@ -0,0 +1,34 @@ +```javascript +import { Client, Messaging, MessagePriority } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updatePush({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + title: '<TITLE>', // optional + body: '<BODY>', // optional + data: {}, // optional + action: '<ACTION>', // optional + image: '<ID1:ID2>', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority.Normal // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md new file mode 100644 index 00000000..c1a5fe9d --- /dev/null +++ b/docs/examples/messaging/update-resend-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateResendProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 00000000..847f6c4b --- /dev/null +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateSendgridProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 00000000..da7feb97 --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateSMS({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + content: '<CONTENT>', // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 00000000..f199dc21 --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,29 @@ +```javascript +import { Client, Messaging, SmtpEncryption } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateSMTPProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + host: '<HOST>', // optional + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md new file mode 100644 index 00000000..95e99996 --- /dev/null +++ b/docs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateTelesignProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 00000000..800bed36 --- /dev/null +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateTextmagicProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md new file mode 100644 index 00000000..bf26e156 --- /dev/null +++ b/docs/examples/messaging/update-topic.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', // optional + subscribe: ["any"] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md new file mode 100644 index 00000000..a3abc88a --- /dev/null +++ b/docs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateTwilioProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + from: '<FROM>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md new file mode 100644 index 00000000..d4961833 --- /dev/null +++ b/docs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const result = await messaging.updateVonageProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + from: '<FROM>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md new file mode 100644 index 00000000..4f5b93e4 --- /dev/null +++ b/docs/examples/project/create-android-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md new file mode 100644 index 00000000..bbb7cff0 --- /dev/null +++ b/docs/examples/project/create-apple-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..a7f09a70 --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createEphemeralKey({ + scopes: [Scopes.ProjectRead], + duration: 600 +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md new file mode 100644 index 00000000..fa315fc9 --- /dev/null +++ b/docs/examples/project/create-key.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [Scopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md new file mode 100644 index 00000000..85a0051a --- /dev/null +++ b/docs/examples/project/create-linux-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..1f575936 --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..cc5af160 --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createSMTPTest({ + emails: [] +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 00000000..d8c4406e --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md new file mode 100644 index 00000000..577065da --- /dev/null +++ b/docs/examples/project/create-web-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md new file mode 100644 index 00000000..a7e7d539 --- /dev/null +++ b/docs/examples/project/create-windows-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.createWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md new file mode 100644 index 00000000..3d66d97e --- /dev/null +++ b/docs/examples/project/delete-key.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.deleteKey({ + keyId: '<KEY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..711123fb --- /dev/null +++ b/docs/examples/project/delete-mock-phone.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.deleteMockPhone({ + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md new file mode 100644 index 00000000..16dc5ddf --- /dev/null +++ b/docs/examples/project/delete-platform.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.deletePlatform({ + platformId: '<PLATFORM_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 00000000..a3eb41a2 --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.deleteVariable({ + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..c6b7efee --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.delete(); + +console.log(result); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..fbb713ef --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project, EmailTemplateType, EmailTemplateLocale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getEmailTemplate({ + templateId: EmailTemplateType.Verification, + locale: EmailTemplateLocale.Af // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md new file mode 100644 index 00000000..db0be391 --- /dev/null +++ b/docs/examples/project/get-key.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getKey({ + keyId: '<KEY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..dadfda25 --- /dev/null +++ b/docs/examples/project/get-mock-phone.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getMockPhone({ + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..e1b23650 --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, OAuthProvider } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getOAuth2Provider({ + providerId: OAuthProvider.Amazon +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md new file mode 100644 index 00000000..56d73893 --- /dev/null +++ b/docs/examples/project/get-platform.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getPlatform({ + platformId: '<PLATFORM_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..9b65db9f --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectPolicy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getPolicy({ + policyId: ProjectPolicy.PasswordDictionary +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 00000000..6e1250a1 --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.getVariable({ + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..f9ca4934 --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listEmailTemplates({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md new file mode 100644 index 00000000..3fdd792a --- /dev/null +++ b/docs/examples/project/list-keys.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listKeys({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..1431ac99 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listMockPhones({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..ac931830 --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listOAuth2Providers({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md new file mode 100644 index 00000000..57186cdd --- /dev/null +++ b/docs/examples/project/list-platforms.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listPlatforms({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..a71dbd3d --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listPolicies({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 00000000..7f2f413b --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.listVariables({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md new file mode 100644 index 00000000..b763954f --- /dev/null +++ b/docs/examples/project/update-android-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md new file mode 100644 index 00000000..9d8d4e84 --- /dev/null +++ b/docs/examples/project/update-apple-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..e7b31bf4 --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project, AuthMethod } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateAuthMethod({ + methodId: AuthMethod.EmailPassword, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-deny-canonical-email-policy.md b/docs/examples/project/update-deny-canonical-email-policy.md new file mode 100644 index 00000000..05da6cd1 --- /dev/null +++ b/docs/examples/project/update-deny-canonical-email-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateDenyCanonicalEmailPolicy({ + enabled: false +}); + +console.log(result); +``` 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 00000000..7018f494 --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateDenyDisposableEmailPolicy({ + enabled: false +}); + +console.log(result); +``` 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 00000000..e6a223d7 --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateDenyFreeEmailPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..42afcb0e --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Project, EmailTemplateType, EmailTemplateLocale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateEmailTemplate({ + templateId: EmailTemplateType.Verification, + locale: EmailTemplateLocale.Af, // optional + subject: '<SUBJECT>', // optional + message: '<MESSAGE>', // optional + senderName: '<SENDER_NAME>', // optional + senderEmail: 'email@example.com', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md new file mode 100644 index 00000000..505c1f25 --- /dev/null +++ b/docs/examples/project/update-key.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [Scopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md new file mode 100644 index 00000000..67f33ac1 --- /dev/null +++ b/docs/examples/project/update-labels.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateLabels({ + labels: [] +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md new file mode 100644 index 00000000..92156ecb --- /dev/null +++ b/docs/examples/project/update-linux-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 00000000..2919e5ee --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateMembershipPrivacyPolicy({ + userId: false, // optional + userEmail: false, // optional + userPhone: false, // optional + userName: false, // optional + userMFA: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..64afb02f --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..54ba34cd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Amazon({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..79abec83 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Apple({ + serviceId: '<SERVICE_ID>', // optional + keyId: '<KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + p8File: '<P8_FILE>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..b0e14b38 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Auth0({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..934587ef --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Authentik({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..46d1c2a1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Autodesk({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md new file mode 100644 index 00000000..5dfeafe1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Bitbucket({ + key: '<KEY>', // optional + secret: '<SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..b50d2c40 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Bitly({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..2075de35 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Box({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..5684566d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Dailymotion({ + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..599cbc01 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Discord({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..9f925148 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Disqus({ + publicKey: '<PUBLIC_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..720fb731 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Dropbox({ + appKey: '<APP_KEY>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..b01acffb --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Etsy({ + keyString: '<KEY_STRING>', // optional + sharedSecret: '<SHARED_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..b96867de --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Facebook({ + appId: '<APP_ID>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..b22912e2 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Figma({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..ca64f4dd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2FusionAuth({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..25fd6e12 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2GitHub({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..06a0a71f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Gitlab({ + applicationId: '<APPLICATION_ID>', // optional + secret: '<SECRET>', // optional + endpoint: 'https://example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..ba27dfe8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project, Prompt } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Google({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + prompt: [Prompt.None], // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..ed69fcfd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Keycloak({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + realmName: '<REALM_NAME>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..22e0b7a8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Kick({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..c3949782 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Linkedin({ + clientId: '<CLIENT_ID>', // optional + primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..98d75a12 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Microsoft({ + applicationId: '<APPLICATION_ID>', // optional + applicationSecret: '<APPLICATION_SECRET>', // optional + tenant: '<TENANT>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..24391ce9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Notion({ + oauthClientId: '<OAUTH_CLIENT_ID>', // optional + oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..75da5672 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Oidc({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + wellKnownURL: 'https://example.com', // optional + authorizationURL: 'https://example.com', // optional + tokenURL: 'https://example.com', // optional + userInfoURL: 'https://example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..406382af --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Okta({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + domain: '', // optional + authorizationServerId: '<AUTHORIZATION_SERVER_ID>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..dcc2959d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2PaypalSandbox({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..6f0650ef --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Paypal({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..ba2de8e6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Podio({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..41cecbbc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Salesforce({ + customerKey: '<CUSTOMER_KEY>', // optional + customerSecret: '<CUSTOMER_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..3ed48cb0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Slack({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..63e3f67e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Spotify({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..2fb44b1d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Stripe({ + clientId: '<CLIENT_ID>', // optional + apiSecretKey: '<API_SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..2db30540 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2TradeshiftSandbox({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..0ff91ada --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Tradeshift({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..243e9c15 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Twitch({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..74c99a5c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2WordPress({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..341f827d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Yahoo({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..a98b6b5d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Yandex({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..1bbb53e7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Zoho({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..8dd33d6d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2Zoom({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..d8e9f514 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateOAuth2X({ + customerKey: '<CUSTOMER_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 00000000..7174d60a --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updatePasswordDictionaryPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 00000000..89f56e22 --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updatePasswordHistoryPolicy({ + total: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 00000000..35039c4d --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updatePasswordPersonalDataPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md new file mode 100644 index 00000000..47f91807 --- /dev/null +++ b/docs/examples/project/update-protocol.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project, ProtocolId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateProtocol({ + protocolId: ProtocolId.Rest, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md new file mode 100644 index 00000000..bc9e78a4 --- /dev/null +++ b/docs/examples/project/update-service.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project, ServiceId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateService({ + serviceId: ServiceId.Account, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 00000000..99c3d437 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateSessionAlertPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 00000000..b17eda43 --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateSessionDurationPolicy({ + duration: 5 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 00000000..17e1e367 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateSessionInvalidationPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 00000000..df33c446 --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateSessionLimitPolicy({ + total: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..42a022a7 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Project, Secure } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateSMTP({ + host: '', // optional + port: null, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + senderEmail: 'email@example.com', // optional + senderName: '<SENDER_NAME>', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + secure: Secure.Tls, // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 00000000..a21f30e0 --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateUserLimitPolicy({ + total: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 00000000..c7a542d0 --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md new file mode 100644 index 00000000..7b0e74f1 --- /dev/null +++ b/docs/examples/project/update-web-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md new file mode 100644 index 00000000..6fdb62b6 --- /dev/null +++ b/docs/examples/project/update-windows-platform.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new Project(client); + +const result = await project.updateWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..69c7459a --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.createAPIRule({ + domain: '' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..5491f090 --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.createFunctionRule({ + domain: '', + functionId: '<FUNCTION_ID>', + branch: '<BRANCH>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..7cca57c6 --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Proxy, StatusCode, ProxyResourceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.createRedirectRule({ + domain: '', + url: 'https://example.com', + statusCode: StatusCode.MovedPermanently301, + resourceId: '<RESOURCE_ID>', + resourceType: ProxyResourceType.Site +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..ca443e1d --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.createSiteRule({ + domain: '', + siteId: '<SITE_ID>', + branch: '<BRANCH>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..414d0636 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.deleteRule({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..21798206 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.getRule({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..e119ccd7 --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.listRules({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..912a8c74 --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new Proxy(client); + +const result = await proxy.updateRuleStatus({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md new file mode 100644 index 00000000..92c3ed83 --- /dev/null +++ b/docs/examples/sites/create-deployment.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.createDeployment({ + siteId: '<SITE_ID>', + code: document.getElementById('uploader').files[0], + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md new file mode 100644 index 00000000..44b28e9b --- /dev/null +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.createDuplicateDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md new file mode 100644 index 00000000..a0b65d3c --- /dev/null +++ b/docs/examples/sites/create-template-deployment.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Sites, TemplateReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.createTemplateDeployment({ + siteId: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + type: TemplateReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md new file mode 100644 index 00000000..ac097f08 --- /dev/null +++ b/docs/examples/sites/create-variable.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.createVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md new file mode 100644 index 00000000..29c7e9a0 --- /dev/null +++ b/docs/examples/sites/create-vcs-deployment.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Sites, VCSReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.createVcsDeployment({ + siteId: '<SITE_ID>', + type: VCSReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md new file mode 100644 index 00000000..077ff02b --- /dev/null +++ b/docs/examples/sites/create.md @@ -0,0 +1,36 @@ +```javascript +import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.create({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: Framework.Analog, + buildRuntime: BuildRuntime.Node145, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + startCommand: '<START_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + adapter: Adapter.Static, // optional + installationId: '<INSTALLATION_ID>', // optional + fallbackFile: '<FALLBACK_FILE>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md new file mode 100644 index 00000000..4946b410 --- /dev/null +++ b/docs/examples/sites/delete-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.deleteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md new file mode 100644 index 00000000..70b9c5b6 --- /dev/null +++ b/docs/examples/sites/delete-log.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.deleteLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md new file mode 100644 index 00000000..b9765373 --- /dev/null +++ b/docs/examples/sites/delete-variable.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.deleteVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md new file mode 100644 index 00000000..536787c2 --- /dev/null +++ b/docs/examples/sites/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.delete({ + siteId: '<SITE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md new file mode 100644 index 00000000..11e8f1b7 --- /dev/null +++ b/docs/examples/sites/get-deployment-download.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites, DeploymentDownloadType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = sites.getDeploymentDownload({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType.Source // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md new file mode 100644 index 00000000..4a2a09e4 --- /dev/null +++ b/docs/examples/sites/get-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.getDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md new file mode 100644 index 00000000..3b659154 --- /dev/null +++ b/docs/examples/sites/get-log.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.getLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md new file mode 100644 index 00000000..3f76531a --- /dev/null +++ b/docs/examples/sites/get-variable.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.getVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md new file mode 100644 index 00000000..5a932f86 --- /dev/null +++ b/docs/examples/sites/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.get({ + siteId: '<SITE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md new file mode 100644 index 00000000..6550104b --- /dev/null +++ b/docs/examples/sites/list-deployments.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.listDeployments({ + siteId: '<SITE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md new file mode 100644 index 00000000..cc97c464 --- /dev/null +++ b/docs/examples/sites/list-frameworks.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.listFrameworks(); + +console.log(result); +``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md new file mode 100644 index 00000000..4e6d399b --- /dev/null +++ b/docs/examples/sites/list-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.listLogs({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md new file mode 100644 index 00000000..49542d33 --- /dev/null +++ b/docs/examples/sites/list-specifications.md @@ -0,0 +1,14 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.listSpecifications(); + +console.log(result); +``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md new file mode 100644 index 00000000..debe474b --- /dev/null +++ b/docs/examples/sites/list-variables.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.listVariables({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md new file mode 100644 index 00000000..f23917ff --- /dev/null +++ b/docs/examples/sites/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md new file mode 100644 index 00000000..1c0cf9ac --- /dev/null +++ b/docs/examples/sites/update-deployment-status.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.updateDeploymentStatus({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md new file mode 100644 index 00000000..e0d9b815 --- /dev/null +++ b/docs/examples/sites/update-site-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.updateSiteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md new file mode 100644 index 00000000..7d38c44b --- /dev/null +++ b/docs/examples/sites/update-variable.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.updateVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md new file mode 100644 index 00000000..3e112a49 --- /dev/null +++ b/docs/examples/sites/update.md @@ -0,0 +1,36 @@ +```javascript +import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = await sites.update({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: Framework.Analog, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + startCommand: '<START_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + buildRuntime: BuildRuntime.Node145, // optional + adapter: Adapter.Static, // optional + fallbackFile: '<FALLBACK_FILE>', // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md new file mode 100644 index 00000000..caa0f5f4 --- /dev/null +++ b/docs/examples/storage/create-bucket.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Storage, Compression, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const result = await storage.createBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index b70885b2..58cb7cdf 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -3,7 +3,8 @@ import { Client, Storage, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md new file mode 100644 index 00000000..dcdd5b9d --- /dev/null +++ b/docs/examples/storage/delete-bucket.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const result = await storage.deleteBucket({ + bucketId: '<BUCKET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 950003b8..de5be7ba 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -3,7 +3,8 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md new file mode 100644 index 00000000..34209f73 --- /dev/null +++ b/docs/examples/storage/get-bucket.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const result = await storage.getBucket({ + bucketId: '<BUCKET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 7758c7b4..5aad168a 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -3,7 +3,8 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 4d01ef0c..ca28c6d2 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -3,7 +3,8 @@ import { Client, Storage, ImageGravity, ImageFormat } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 682e947c..5e7df139 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -3,7 +3,8 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 82607140..7542ff53 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -3,7 +3,8 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md new file mode 100644 index 00000000..213f49fb --- /dev/null +++ b/docs/examples/storage/list-buckets.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const result = await storage.listBuckets({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index f2dd2f44..5d97d6e2 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -3,7 +3,8 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md new file mode 100644 index 00000000..d1d3d217 --- /dev/null +++ b/docs/examples/storage/update-bucket.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Storage, Compression, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const result = await storage.updateBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index eef78a1d..4c41be57 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -3,7 +3,8 @@ import { Client, Storage, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const storage = new Storage(client); diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..4e6de6e4 --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createBigIntColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 00000000..46587633 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 00000000..0fa4bf54 --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createDatetimeColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 00000000..b0e8f556 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 00000000..38b8a1e1 --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 00000000..b79de08a --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createFloatColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 00000000..577b4298 --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB, TablesDBIndexType, OrderBy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + type: TablesDBIndexType.Key, + columns: [], + orders: [OrderBy.Asc], // optional + lengths: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 00000000..aebb42d9 --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createIntegerColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 00000000..8f3b9b9c --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md new file mode 100644 index 00000000..b75db329 --- /dev/null +++ b/docs/examples/tablesdb/create-line-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createLineColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 00000000..32d8c155 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createLongtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 00000000..1ba3db8a --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createMediumtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 739b4e62..f73f91c4 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md new file mode 100644 index 00000000..388d2b7f --- /dev/null +++ b/docs/examples/tablesdb/create-point-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createPointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md new file mode 100644 index 00000000..932c9eb8 --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createPolygonColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 00000000..3fce5eeb --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB, RelationshipType, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + relatedTableId: '<RELATED_TABLE_ID>', + type: RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate.Cascade // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 105c4445..46f09b4e 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -3,7 +3,8 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 00000000..8b649750 --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 00000000..fa49a7e1 --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createStringColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 00000000..573e4029 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + columns: [], // optional + indexes: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 00000000..a0ef3269 --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createTextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 333eb80e..199d150a 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 00000000..860f53c4 --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 00000000..b1a1c1ec --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createVarcharColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 00000000..b9e8a426 --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.create({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index bad89263..faffbcf3 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 00000000..3ea6ea65 --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 00000000..b6315007 --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 12663286..5d47e8ec 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 00000000..7b5ba0a5 --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 00000000..672c7d4b --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index 0c98481c..f2c49810 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 00000000..1356ff93 --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.delete({ + databaseId: '<DATABASE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 00000000..ae1c9eb7 --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 00000000..621debde --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 14316385..688b96df 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 00000000..aa099413 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 00e72497..7f8a50df 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 00000000..08460715 --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.get({ + databaseId: '<DATABASE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 2fa3354b..d671cbc5 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 00000000..a314e1d8 --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listColumns({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 00000000..fcddddb8 --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listIndexes({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 455ec6fe..3259ce0e 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 00000000..4c439657 --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listTables({ + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index b6448518..c575a7fc 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 00000000..607e5b5e --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..1ef1adf3 --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateBigIntColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 00000000..7059d711 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 00000000..62c4135f --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateDatetimeColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 00000000..5a844ea1 --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 00000000..694faa50 --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 00000000..8fbb3226 --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateFloatColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 00000000..686df6d8 --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,23 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateIntegerColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 00000000..471f213e --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md new file mode 100644 index 00000000..ba7cb549 --- /dev/null +++ b/docs/examples/tablesdb/update-line-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateLineColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 00000000..f87f9398 --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateLongtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 00000000..6bcfef3a --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateMediumtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md new file mode 100644 index 00000000..3ce5186d --- /dev/null +++ b/docs/examples/tablesdb/update-point-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updatePointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md new file mode 100644 index 00000000..997bf18c --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updatePolygonColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 00000000..89cca3d4 --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + onDelete: RelationMutate.Cascade, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 77a775b3..ee7c4440 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -3,7 +3,8 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 00000000..73b59c2c --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,26 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 00000000..870d0ca0 --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateStringColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 00000000..0cdda11b --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', // optional + permissions: [Permission.read(Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 00000000..6071843b --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateTextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index 80a8b89d..323adc7b 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -3,7 +3,8 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 00000000..c300f6a1 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 00000000..652abf19 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateVarcharColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 00000000..e618ce90 --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.update({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index fb971043..46a8f9d4 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -3,7 +3,8 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 00000000..edf4e3bd --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.upsertRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 5a23e078..4b55200b 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 2c72bcdf..7c996a2d 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 2fe13278..52c2e773 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 054e34ef..053dac1a 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index bdd6c784..3d0b92a0 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index bf20ed47..7142bbbc 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 836a8e08..7def82d9 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index fd3fcd30..004da4c3 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 3406925f..e5ed2c9e 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 2ca1c62d..0f7dacc6 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index ecfd1bc8..9fac38ab 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index dce11078..f78ed579 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 2c8a15a1..32404b3a 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -3,7 +3,8 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with const teams = new Teams(client); diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md new file mode 100644 index 00000000..f57ecd3c --- /dev/null +++ b/docs/examples/tokens/create-file-token.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const result = await tokens.createFileToken({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md new file mode 100644 index 00000000..eaffe5d8 --- /dev/null +++ b/docs/examples/tokens/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const result = await tokens.delete({ + tokenId: '<TOKEN_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md new file mode 100644 index 00000000..b7d1caab --- /dev/null +++ b/docs/examples/tokens/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const result = await tokens.get({ + tokenId: '<TOKEN_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md new file mode 100644 index 00000000..ff3270ab --- /dev/null +++ b/docs/examples/tokens/list.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const result = await tokens.list({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md new file mode 100644 index 00000000..6e2c08b1 --- /dev/null +++ b/docs/examples/tokens/update.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const result = await tokens.update({ + tokenId: '<TOKEN_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md new file mode 100644 index 00000000..0b76d58b --- /dev/null +++ b/docs/examples/users/create-argon-2-user.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createArgon2User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md new file mode 100644 index 00000000..99338d26 --- /dev/null +++ b/docs/examples/users/create-bcrypt-user.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createBcryptUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md new file mode 100644 index 00000000..b22d0621 --- /dev/null +++ b/docs/examples/users/create-jwt.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createJWT({ + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // optional + duration: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md new file mode 100644 index 00000000..e26104c0 --- /dev/null +++ b/docs/examples/users/create-md-5-user.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createMD5User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 00000000..1a2cefee --- /dev/null +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createMFARecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md new file mode 100644 index 00000000..a9e06667 --- /dev/null +++ b/docs/examples/users/create-ph-pass-user.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createPHPassUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md new file mode 100644 index 00000000..9cdbc8a1 --- /dev/null +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createScryptModifiedUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md new file mode 100644 index 00000000..073c6f9e --- /dev/null +++ b/docs/examples/users/create-scrypt-user.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createScryptUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: null, + passwordMemory: null, + passwordParallel: null, + passwordLength: null, + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md new file mode 100644 index 00000000..cae7a143 --- /dev/null +++ b/docs/examples/users/create-session.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createSession({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md new file mode 100644 index 00000000..d383ac0e --- /dev/null +++ b/docs/examples/users/create-sha-user.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Users, PasswordHash } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createSHAUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash.Sha1, // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md new file mode 100644 index 00000000..f5e61468 --- /dev/null +++ b/docs/examples/users/create-target.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Users, MessagingProviderType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType.Email, + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md new file mode 100644 index 00000000..da96054a --- /dev/null +++ b/docs/examples/users/create-token.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.createToken({ + userId: '<USER_ID>', + length: 4, // optional + expire: 60 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md new file mode 100644 index 00000000..e5ea5d67 --- /dev/null +++ b/docs/examples/users/create.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.create({ + userId: '<USER_ID>', + email: 'email@example.com', // optional + phone: '+12065550100', // optional + password: '', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 00000000..4c645536 --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.deleteIdentity({ + identityId: '<IDENTITY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md new file mode 100644 index 00000000..f9a331a9 --- /dev/null +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users, AuthenticatorType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.deleteMFAAuthenticator({ + userId: '<USER_ID>', + type: AuthenticatorType.Totp +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md new file mode 100644 index 00000000..e0d1d739 --- /dev/null +++ b/docs/examples/users/delete-session.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.deleteSession({ + userId: '<USER_ID>', + sessionId: '<SESSION_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md new file mode 100644 index 00000000..5d511070 --- /dev/null +++ b/docs/examples/users/delete-sessions.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.deleteSessions({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md new file mode 100644 index 00000000..bec3a103 --- /dev/null +++ b/docs/examples/users/delete-target.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.deleteTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md new file mode 100644 index 00000000..1b4cab05 --- /dev/null +++ b/docs/examples/users/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.delete({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 00000000..044951a1 --- /dev/null +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.getMFARecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md new file mode 100644 index 00000000..75c951c5 --- /dev/null +++ b/docs/examples/users/get-prefs.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.getPrefs({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md new file mode 100644 index 00000000..dd009647 --- /dev/null +++ b/docs/examples/users/get-target.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.getTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md new file mode 100644 index 00000000..a18fc14a --- /dev/null +++ b/docs/examples/users/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.get({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 00000000..9c94b793 --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listIdentities({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md new file mode 100644 index 00000000..0797e160 --- /dev/null +++ b/docs/examples/users/list-logs.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listLogs({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md new file mode 100644 index 00000000..a477e729 --- /dev/null +++ b/docs/examples/users/list-memberships.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listMemberships({ + userId: '<USER_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md new file mode 100644 index 00000000..ca68b56b --- /dev/null +++ b/docs/examples/users/list-mfa-factors.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listMFAFactors({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md new file mode 100644 index 00000000..2d77cb57 --- /dev/null +++ b/docs/examples/users/list-sessions.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listSessions({ + userId: '<USER_ID>', + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md new file mode 100644 index 00000000..beb7f0eb --- /dev/null +++ b/docs/examples/users/list-targets.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.listTargets({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md new file mode 100644 index 00000000..44d7b581 --- /dev/null +++ b/docs/examples/users/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md new file mode 100644 index 00000000..5e72d67c --- /dev/null +++ b/docs/examples/users/update-email-verification.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateEmailVerification({ + userId: '<USER_ID>', + emailVerification: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md new file mode 100644 index 00000000..a3d18595 --- /dev/null +++ b/docs/examples/users/update-email.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateEmail({ + userId: '<USER_ID>', + email: 'email@example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md new file mode 100644 index 00000000..9edd8207 --- /dev/null +++ b/docs/examples/users/update-impersonator.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateImpersonator({ + userId: '<USER_ID>', + impersonator: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 00000000..5b114712 --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateLabels({ + userId: '<USER_ID>', + labels: [] +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 00000000..7060547e --- /dev/null +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateMFARecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md new file mode 100644 index 00000000..48b08fc5 --- /dev/null +++ b/docs/examples/users/update-mfa.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateMFA({ + userId: '<USER_ID>', + mfa: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md new file mode 100644 index 00000000..3ff68888 --- /dev/null +++ b/docs/examples/users/update-name.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateName({ + userId: '<USER_ID>', + name: '<NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md new file mode 100644 index 00000000..018c726d --- /dev/null +++ b/docs/examples/users/update-password.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updatePassword({ + userId: '<USER_ID>', + password: '' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md new file mode 100644 index 00000000..3cea6d9a --- /dev/null +++ b/docs/examples/users/update-phone-verification.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updatePhoneVerification({ + userId: '<USER_ID>', + phoneVerification: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md new file mode 100644 index 00000000..d58be753 --- /dev/null +++ b/docs/examples/users/update-phone.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updatePhone({ + userId: '<USER_ID>', + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md new file mode 100644 index 00000000..ead7a0b4 --- /dev/null +++ b/docs/examples/users/update-prefs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updatePrefs({ + userId: '<USER_ID>', + prefs: {} +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md new file mode 100644 index 00000000..2d04e672 --- /dev/null +++ b/docs/examples/users/update-status.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateStatus({ + userId: '<USER_ID>', + status: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md new file mode 100644 index 00000000..350b4b66 --- /dev/null +++ b/docs/examples/users/update-target.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const result = await users.updateTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // optional + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md new file mode 100644 index 00000000..3158cbcf --- /dev/null +++ b/docs/examples/webhooks/create.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.create({ + webhookId: '<WEBHOOK_ID>', + url: '', + name: '<NAME>', + events: [], + enabled: false, // optional + tls: false, // optional + authUsername: '<AUTH_USERNAME>', // optional + authPassword: '<AUTH_PASSWORD>', // optional + secret: '<SECRET>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md new file mode 100644 index 00000000..35a061c8 --- /dev/null +++ b/docs/examples/webhooks/delete.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.delete({ + webhookId: '<WEBHOOK_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md new file mode 100644 index 00000000..915cffe1 --- /dev/null +++ b/docs/examples/webhooks/get.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.get({ + webhookId: '<WEBHOOK_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md new file mode 100644 index 00000000..a4826aa9 --- /dev/null +++ b/docs/examples/webhooks/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.list({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md new file mode 100644 index 00000000..4830a12a --- /dev/null +++ b/docs/examples/webhooks/update-secret.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.updateSecret({ + webhookId: '<WEBHOOK_ID>', + secret: '<SECRET>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md new file mode 100644 index 00000000..58b6dc3f --- /dev/null +++ b/docs/examples/webhooks/update.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new Webhooks(client); + +const result = await webhooks.update({ + webhookId: '<WEBHOOK_ID>', + name: '<NAME>', + url: '', + events: [], + enabled: false, // optional + tls: false, // optional + authUsername: '<AUTH_USERNAME>', // optional + authPassword: '<AUTH_PASSWORD>' // optional +}); + +console.log(result); +``` diff --git a/package-lock.json b/package-lock.json index 0adf962c..a3aa13e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appwrite", - "version": "25.1.0", + "version": "26.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "appwrite", - "version": "25.1.0", + "version": "26.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 42b5b992..b3307c14 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "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": "25.1.0", + "version": "26.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index d04d1ed5..5a30c879 100644 --- a/src/client.ts +++ b/src/client.ts @@ -354,9 +354,11 @@ class Client { endpoint: string; endpointRealtime: string; project: string; + key: string; jwt: string; locale: string; session: string; + forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; @@ -366,9 +368,11 @@ class Client { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', + key: '', jwt: '', locale: '', session: '', + forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', @@ -382,7 +386,7 @@ class Client { 'x-sdk-name': 'Web', 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '25.1.0', + 'x-sdk-version': '26.0.0', 'X-Appwrite-Response-Format': '1.9.4', }; @@ -456,6 +460,20 @@ class Client { this.config.project = value; return this; } + /** + * Set Key + * + * Your secret API key + * + * @param value string + * + * @return {this} + */ + setKey(value: string): this { + this.headers['X-Appwrite-Key'] = value; + this.config.key = value; + return this; + } /** * Set JWT * @@ -496,6 +514,20 @@ class Client { this.config.session = value; return this; } + /** + * Set ForwardedUserAgent + * + * The user agent string of the client that made the request + * + * @param value string + * + * @return {this} + */ + setForwardedUserAgent(value: string): this { + this.headers['X-Forwarded-User-Agent'] = value; + this.config.forwardeduseragent = value; + return this; + } /** * Set DevKey * diff --git a/src/enums/adapter.ts b/src/enums/adapter.ts new file mode 100644 index 00000000..a3b1ae0c --- /dev/null +++ b/src/enums/adapter.ts @@ -0,0 +1,4 @@ +export enum Adapter { + Static = 'static', + Ssr = 'ssr', +} \ No newline at end of file diff --git a/src/enums/attribute-status.ts b/src/enums/attribute-status.ts new file mode 100644 index 00000000..ade1d36a --- /dev/null +++ b/src/enums/attribute-status.ts @@ -0,0 +1,7 @@ +export enum AttributeStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/auth-method.ts b/src/enums/auth-method.ts new file mode 100644 index 00000000..d5800ad9 --- /dev/null +++ b/src/enums/auth-method.ts @@ -0,0 +1,9 @@ +export enum AuthMethod { + Emailpassword = 'email-password', + Magicurl = 'magic-url', + Emailotp = 'email-otp', + Anonymous = 'anonymous', + Invites = 'invites', + Jwt = 'jwt', + Phone = 'phone', +} \ No newline at end of file diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts new file mode 100644 index 00000000..bd0582ce --- /dev/null +++ b/src/enums/backup-services.ts @@ -0,0 +1,8 @@ +export enum BackupServices { + Databases = 'databases', + Tablesdb = 'tablesdb', + Documentsdb = 'documentsdb', + Vectorsdb = 'vectorsdb', + Functions = 'functions', + Storage = 'storage', +} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts new file mode 100644 index 00000000..dddeeb2b --- /dev/null +++ b/src/enums/build-runtime.ts @@ -0,0 +1,94 @@ +export enum BuildRuntime { + Node145 = 'node-14.5', + Node160 = 'node-16.0', + Node180 = 'node-18.0', + Node190 = 'node-19.0', + Node200 = 'node-20.0', + Node210 = 'node-21.0', + Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', + Php80 = 'php-8.0', + Php81 = 'php-8.1', + Php82 = 'php-8.2', + Php83 = 'php-8.3', + Php84 = 'php-8.4', + Ruby30 = 'ruby-3.0', + Ruby31 = 'ruby-3.1', + Ruby32 = 'ruby-3.2', + Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', + Python38 = 'python-3.8', + Python39 = 'python-3.9', + Python310 = 'python-3.10', + Python311 = 'python-3.11', + Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', + Pythonml311 = 'python-ml-3.11', + Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', + Deno140 = 'deno-1.40', + Deno146 = 'deno-1.46', + Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', + Dart215 = 'dart-2.15', + Dart216 = 'dart-2.16', + Dart217 = 'dart-2.17', + Dart218 = 'dart-2.18', + Dart219 = 'dart-2.19', + Dart30 = 'dart-3.0', + Dart31 = 'dart-3.1', + Dart33 = 'dart-3.3', + Dart35 = 'dart-3.5', + Dart38 = 'dart-3.8', + Dart39 = 'dart-3.9', + Dart310 = 'dart-3.10', + Dart311 = 'dart-3.11', + Dotnet60 = 'dotnet-6.0', + Dotnet70 = 'dotnet-7.0', + Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', + Java80 = 'java-8.0', + Java110 = 'java-11.0', + Java170 = 'java-17.0', + Java180 = 'java-18.0', + Java210 = 'java-21.0', + Java22 = 'java-22', + Java25 = 'java-25', + Swift55 = 'swift-5.5', + Swift58 = 'swift-5.8', + Swift59 = 'swift-5.9', + Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', + Kotlin16 = 'kotlin-1.6', + Kotlin18 = 'kotlin-1.8', + Kotlin19 = 'kotlin-1.9', + Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', + Cpp17 = 'cpp-17', + Cpp20 = 'cpp-20', + Bun10 = 'bun-1.0', + Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', + Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', + Rust183 = 'rust-1.83', + Static1 = 'static-1', + Flutter324 = 'flutter-3.24', + Flutter327 = 'flutter-3.27', + Flutter329 = 'flutter-3.29', + Flutter332 = 'flutter-3.32', + Flutter335 = 'flutter-3.35', + Flutter338 = 'flutter-3.38', + Flutter341 = 'flutter-3.41', +} \ No newline at end of file diff --git a/src/enums/column-status.ts b/src/enums/column-status.ts new file mode 100644 index 00000000..f53e8a66 --- /dev/null +++ b/src/enums/column-status.ts @@ -0,0 +1,7 @@ +export enum ColumnStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/compression.ts b/src/enums/compression.ts new file mode 100644 index 00000000..1bec0e78 --- /dev/null +++ b/src/enums/compression.ts @@ -0,0 +1,5 @@ +export enum Compression { + None = 'none', + Gzip = 'gzip', + Zstd = 'zstd', +} \ No newline at end of file diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts new file mode 100644 index 00000000..8ccd9699 --- /dev/null +++ b/src/enums/database-type.ts @@ -0,0 +1,6 @@ +export enum DatabaseType { + Legacy = 'legacy', + Tablesdb = 'tablesdb', + Documentsdb = 'documentsdb', + Vectorsdb = 'vectorsdb', +} \ No newline at end of file diff --git a/src/enums/databases-index-type.ts b/src/enums/databases-index-type.ts new file mode 100644 index 00000000..85ccf867 --- /dev/null +++ b/src/enums/databases-index-type.ts @@ -0,0 +1,6 @@ +export enum DatabasesIndexType { + Key = 'key', + Fulltext = 'fulltext', + Unique = 'unique', + Spatial = 'spatial', +} \ No newline at end of file diff --git a/src/enums/deployment-download-type.ts b/src/enums/deployment-download-type.ts new file mode 100644 index 00000000..538709bc --- /dev/null +++ b/src/enums/deployment-download-type.ts @@ -0,0 +1,4 @@ +export enum DeploymentDownloadType { + Source = 'source', + Output = 'output', +} \ No newline at end of file diff --git a/src/enums/deployment-status.ts b/src/enums/deployment-status.ts new file mode 100644 index 00000000..7e8f4a1b --- /dev/null +++ b/src/enums/deployment-status.ts @@ -0,0 +1,8 @@ +export enum DeploymentStatus { + Waiting = 'waiting', + Processing = 'processing', + Building = 'building', + Ready = 'ready', + Canceled = 'canceled', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/email-template-locale.ts b/src/enums/email-template-locale.ts new file mode 100644 index 00000000..82656b89 --- /dev/null +++ b/src/enums/email-template-locale.ts @@ -0,0 +1,133 @@ +export enum EmailTemplateLocale { + Af = 'af', + Arae = 'ar-ae', + Arbh = 'ar-bh', + Ardz = 'ar-dz', + Areg = 'ar-eg', + Ariq = 'ar-iq', + Arjo = 'ar-jo', + Arkw = 'ar-kw', + Arlb = 'ar-lb', + Arly = 'ar-ly', + Arma = 'ar-ma', + Arom = 'ar-om', + Arqa = 'ar-qa', + Arsa = 'ar-sa', + Arsy = 'ar-sy', + Artn = 'ar-tn', + Arye = 'ar-ye', + As = 'as', + Az = 'az', + Be = 'be', + Bg = 'bg', + Bh = 'bh', + Bn = 'bn', + Bs = 'bs', + Ca = 'ca', + Cs = 'cs', + Cy = 'cy', + Da = 'da', + De = 'de', + Deat = 'de-at', + Dech = 'de-ch', + Deli = 'de-li', + Delu = 'de-lu', + El = 'el', + En = 'en', + Enau = 'en-au', + Enbz = 'en-bz', + Enca = 'en-ca', + Engb = 'en-gb', + Enie = 'en-ie', + Enjm = 'en-jm', + Ennz = 'en-nz', + Entt = 'en-tt', + Enus = 'en-us', + Enza = 'en-za', + Eo = 'eo', + Es = 'es', + Esar = 'es-ar', + Esbo = 'es-bo', + Escl = 'es-cl', + Esco = 'es-co', + Escr = 'es-cr', + Esdo = 'es-do', + Esec = 'es-ec', + Esgt = 'es-gt', + Eshn = 'es-hn', + Esmx = 'es-mx', + Esni = 'es-ni', + Espa = 'es-pa', + Espe = 'es-pe', + Espr = 'es-pr', + Espy = 'es-py', + Essv = 'es-sv', + Esuy = 'es-uy', + Esve = 'es-ve', + Et = 'et', + Eu = 'eu', + Fa = 'fa', + Fi = 'fi', + Fo = 'fo', + Fr = 'fr', + Frbe = 'fr-be', + Frca = 'fr-ca', + Frch = 'fr-ch', + Frlu = 'fr-lu', + Ga = 'ga', + Gd = 'gd', + He = 'he', + Hi = 'hi', + Hr = 'hr', + Hu = 'hu', + Id = 'id', + Is = 'is', + It = 'it', + Itch = 'it-ch', + Ja = 'ja', + Ji = 'ji', + Ko = 'ko', + Ku = 'ku', + Lt = 'lt', + Lv = 'lv', + Mk = 'mk', + Ml = 'ml', + Ms = 'ms', + Mt = 'mt', + Nb = 'nb', + Ne = 'ne', + Nl = 'nl', + Nlbe = 'nl-be', + Nn = 'nn', + No = 'no', + Pa = 'pa', + Pl = 'pl', + Pt = 'pt', + Ptbr = 'pt-br', + Rm = 'rm', + Ro = 'ro', + Romd = 'ro-md', + Ru = 'ru', + Rumd = 'ru-md', + Sb = 'sb', + Sk = 'sk', + Sl = 'sl', + Sq = 'sq', + Sr = 'sr', + Sv = 'sv', + Svfi = 'sv-fi', + Th = 'th', + Tn = 'tn', + Tr = 'tr', + Ts = 'ts', + Ua = 'ua', + Ur = 'ur', + Ve = 've', + Vi = 'vi', + Xh = 'xh', + Zhcn = 'zh-cn', + Zhhk = 'zh-hk', + Zhsg = 'zh-sg', + Zhtw = 'zh-tw', + Zu = 'zu', +} \ No newline at end of file diff --git a/src/enums/email-template-type.ts b/src/enums/email-template-type.ts new file mode 100644 index 00000000..2a561bf0 --- /dev/null +++ b/src/enums/email-template-type.ts @@ -0,0 +1,9 @@ +export enum EmailTemplateType { + Verification = 'verification', + MagicSession = 'magicSession', + Recovery = 'recovery', + Invitation = 'invitation', + MfaChallenge = 'mfaChallenge', + SessionAlert = 'sessionAlert', + OtpSession = 'otpSession', +} \ No newline at end of file diff --git a/src/enums/framework.ts b/src/enums/framework.ts new file mode 100644 index 00000000..7093da33 --- /dev/null +++ b/src/enums/framework.ts @@ -0,0 +1,17 @@ +export enum Framework { + Analog = 'analog', + Angular = 'angular', + Nextjs = 'nextjs', + React = 'react', + Nuxt = 'nuxt', + Vue = 'vue', + Sveltekit = 'sveltekit', + Astro = 'astro', + Tanstackstart = 'tanstack-start', + Remix = 'remix', + Lynx = 'lynx', + Flutter = 'flutter', + Reactnative = 'react-native', + Vite = 'vite', + Other = 'other', +} \ No newline at end of file diff --git a/src/enums/health-antivirus-status.ts b/src/enums/health-antivirus-status.ts new file mode 100644 index 00000000..d4da4c4f --- /dev/null +++ b/src/enums/health-antivirus-status.ts @@ -0,0 +1,5 @@ +export enum HealthAntivirusStatus { + Disabled = 'disabled', + Offline = 'offline', + Online = 'online', +} \ No newline at end of file diff --git a/src/enums/health-check-status.ts b/src/enums/health-check-status.ts new file mode 100644 index 00000000..9dbc6810 --- /dev/null +++ b/src/enums/health-check-status.ts @@ -0,0 +1,4 @@ +export enum HealthCheckStatus { + Pass = 'pass', + Fail = 'fail', +} \ No newline at end of file diff --git a/src/enums/index-status.ts b/src/enums/index-status.ts new file mode 100644 index 00000000..6ce90ac8 --- /dev/null +++ b/src/enums/index-status.ts @@ -0,0 +1,7 @@ +export enum IndexStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/message-priority.ts b/src/enums/message-priority.ts new file mode 100644 index 00000000..f3113a85 --- /dev/null +++ b/src/enums/message-priority.ts @@ -0,0 +1,4 @@ +export enum MessagePriority { + Normal = 'normal', + High = 'high', +} \ No newline at end of file diff --git a/src/enums/message-status.ts b/src/enums/message-status.ts new file mode 100644 index 00000000..08bd483b --- /dev/null +++ b/src/enums/message-status.ts @@ -0,0 +1,7 @@ +export enum MessageStatus { + Draft = 'draft', + Processing = 'processing', + Scheduled = 'scheduled', + Sent = 'sent', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/messaging-provider-type.ts b/src/enums/messaging-provider-type.ts new file mode 100644 index 00000000..18c9929b --- /dev/null +++ b/src/enums/messaging-provider-type.ts @@ -0,0 +1,5 @@ +export enum MessagingProviderType { + Email = 'email', + Sms = 'sms', + Push = 'push', +} \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts new file mode 100644 index 00000000..8cd297bc --- /dev/null +++ b/src/enums/name.ts @@ -0,0 +1,15 @@ +export enum Name { + V1database = 'v1-database', + V1deletes = 'v1-deletes', + V1audits = 'v1-audits', + V1mails = 'v1-mails', + V1functions = 'v1-functions', + V1statsresources = 'v1-stats-resources', + V1statsusage = 'v1-stats-usage', + V1webhooks = 'v1-webhooks', + V1certificates = 'v1-certificates', + V1builds = 'v1-builds', + V1screenshots = 'v1-screenshots', + V1messaging = 'v1-messaging', + V1migrations = 'v1-migrations', +} \ No newline at end of file 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 00000000..f8e98e12 --- /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 cc9e340b..06189633 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -42,4 +42,6 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', } \ No newline at end of file diff --git a/src/enums/order-by.ts b/src/enums/order-by.ts new file mode 100644 index 00000000..62dffb98 --- /dev/null +++ b/src/enums/order-by.ts @@ -0,0 +1,4 @@ +export enum OrderBy { + Asc = 'asc', + Desc = 'desc', +} \ No newline at end of file diff --git a/src/enums/password-hash.ts b/src/enums/password-hash.ts new file mode 100644 index 00000000..76834af4 --- /dev/null +++ b/src/enums/password-hash.ts @@ -0,0 +1,13 @@ +export enum PasswordHash { + Sha1 = 'sha1', + Sha224 = 'sha224', + Sha256 = 'sha256', + Sha384 = 'sha384', + Sha512224 = 'sha512/224', + Sha512256 = 'sha512/256', + Sha512 = 'sha512', + Sha3224 = 'sha3-224', + Sha3256 = 'sha3-256', + Sha3384 = 'sha3-384', + Sha3512 = 'sha3-512', +} \ No newline at end of file diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts new file mode 100644 index 00000000..bde1d30f --- /dev/null +++ b/src/enums/platform-type.ts @@ -0,0 +1,7 @@ +export enum PlatformType { + Windows = 'windows', + Apple = 'apple', + Android = 'android', + Linux = 'linux', + Web = 'web', +} \ No newline at end of file diff --git a/src/enums/project-policy.ts b/src/enums/project-policy.ts new file mode 100644 index 00000000..d52bf99a --- /dev/null +++ b/src/enums/project-policy.ts @@ -0,0 +1,11 @@ +export enum ProjectPolicy { + Passworddictionary = 'password-dictionary', + Passwordhistory = 'password-history', + Passwordpersonaldata = 'password-personal-data', + Sessionalert = 'session-alert', + Sessionduration = 'session-duration', + Sessioninvalidation = 'session-invalidation', + Sessionlimit = 'session-limit', + Userlimit = 'user-limit', + Membershipprivacy = 'membership-privacy', +} \ No newline at end of file diff --git a/src/enums/prompt.ts b/src/enums/prompt.ts new file mode 100644 index 00000000..9bb101fa --- /dev/null +++ b/src/enums/prompt.ts @@ -0,0 +1,5 @@ +export enum Prompt { + None = 'none', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/protocol-id.ts b/src/enums/protocol-id.ts new file mode 100644 index 00000000..94d9095f --- /dev/null +++ b/src/enums/protocol-id.ts @@ -0,0 +1,5 @@ +export enum ProtocolId { + Rest = 'rest', + Graphql = 'graphql', + Websocket = 'websocket', +} \ No newline at end of file diff --git a/src/enums/proxy-resource-type.ts b/src/enums/proxy-resource-type.ts new file mode 100644 index 00000000..e04c8046 --- /dev/null +++ b/src/enums/proxy-resource-type.ts @@ -0,0 +1,4 @@ +export enum ProxyResourceType { + Site = 'site', + Function = 'function', +} \ No newline at end of file diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts new file mode 100644 index 00000000..89236c74 --- /dev/null +++ b/src/enums/proxy-rule-deployment-resource-type.ts @@ -0,0 +1,4 @@ +export enum ProxyRuleDeploymentResourceType { + Function = 'function', + Site = 'site', +} \ No newline at end of file diff --git a/src/enums/proxy-rule-status.ts b/src/enums/proxy-rule-status.ts new file mode 100644 index 00000000..67b8e4cb --- /dev/null +++ b/src/enums/proxy-rule-status.ts @@ -0,0 +1,5 @@ +export enum ProxyRuleStatus { + Unverified = 'unverified', + Verifying = 'verifying', + Verified = 'verified', +} \ No newline at end of file diff --git a/src/enums/relation-mutate.ts b/src/enums/relation-mutate.ts new file mode 100644 index 00000000..722a7572 --- /dev/null +++ b/src/enums/relation-mutate.ts @@ -0,0 +1,5 @@ +export enum RelationMutate { + Cascade = 'cascade', + Restrict = 'restrict', + SetNull = 'setNull', +} \ No newline at end of file diff --git a/src/enums/relationship-type.ts b/src/enums/relationship-type.ts new file mode 100644 index 00000000..532015af --- /dev/null +++ b/src/enums/relationship-type.ts @@ -0,0 +1,6 @@ +export enum RelationshipType { + OneToOne = 'oneToOne', + ManyToOne = 'manyToOne', + ManyToMany = 'manyToMany', + OneToMany = 'oneToMany', +} \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts new file mode 100644 index 00000000..a2b22ef0 --- /dev/null +++ b/src/enums/runtime.ts @@ -0,0 +1,94 @@ +export enum Runtime { + Node145 = 'node-14.5', + Node160 = 'node-16.0', + Node180 = 'node-18.0', + Node190 = 'node-19.0', + Node200 = 'node-20.0', + Node210 = 'node-21.0', + Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', + Php80 = 'php-8.0', + Php81 = 'php-8.1', + Php82 = 'php-8.2', + Php83 = 'php-8.3', + Php84 = 'php-8.4', + Ruby30 = 'ruby-3.0', + Ruby31 = 'ruby-3.1', + Ruby32 = 'ruby-3.2', + Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', + Python38 = 'python-3.8', + Python39 = 'python-3.9', + Python310 = 'python-3.10', + Python311 = 'python-3.11', + Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', + Pythonml311 = 'python-ml-3.11', + Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', + Deno140 = 'deno-1.40', + Deno146 = 'deno-1.46', + Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', + Dart215 = 'dart-2.15', + Dart216 = 'dart-2.16', + Dart217 = 'dart-2.17', + Dart218 = 'dart-2.18', + Dart219 = 'dart-2.19', + Dart30 = 'dart-3.0', + Dart31 = 'dart-3.1', + Dart33 = 'dart-3.3', + Dart35 = 'dart-3.5', + Dart38 = 'dart-3.8', + Dart39 = 'dart-3.9', + Dart310 = 'dart-3.10', + Dart311 = 'dart-3.11', + Dotnet60 = 'dotnet-6.0', + Dotnet70 = 'dotnet-7.0', + Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', + Java80 = 'java-8.0', + Java110 = 'java-11.0', + Java170 = 'java-17.0', + Java180 = 'java-18.0', + Java210 = 'java-21.0', + Java22 = 'java-22', + Java25 = 'java-25', + Swift55 = 'swift-5.5', + Swift58 = 'swift-5.8', + Swift59 = 'swift-5.9', + Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', + Kotlin16 = 'kotlin-1.6', + Kotlin18 = 'kotlin-1.8', + Kotlin19 = 'kotlin-1.9', + Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', + Cpp17 = 'cpp-17', + Cpp20 = 'cpp-20', + Bun10 = 'bun-1.0', + Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', + Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', + Rust183 = 'rust-1.83', + Static1 = 'static-1', + Flutter324 = 'flutter-3.24', + Flutter327 = 'flutter-3.27', + Flutter329 = 'flutter-3.29', + Flutter332 = 'flutter-3.32', + Flutter335 = 'flutter-3.35', + Flutter338 = 'flutter-3.38', + Flutter341 = 'flutter-3.41', +} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts new file mode 100644 index 00000000..5c812100 --- /dev/null +++ b/src/enums/scopes.ts @@ -0,0 +1,89 @@ +export enum Scopes { + 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', + 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', +} \ No newline at end of file diff --git a/src/enums/secure.ts b/src/enums/secure.ts new file mode 100644 index 00000000..0ab54cf8 --- /dev/null +++ b/src/enums/secure.ts @@ -0,0 +1,4 @@ +export enum Secure { + Tls = 'tls', + Ssl = 'ssl', +} \ No newline at end of file diff --git a/src/enums/service-id.ts b/src/enums/service-id.ts new file mode 100644 index 00000000..29281124 --- /dev/null +++ b/src/enums/service-id.ts @@ -0,0 +1,19 @@ +export enum ServiceId { + Account = 'account', + Avatars = 'avatars', + Databases = 'databases', + Tablesdb = 'tablesdb', + Locale = 'locale', + Health = 'health', + Project = 'project', + Storage = 'storage', + Teams = 'teams', + Users = 'users', + Vcs = 'vcs', + Sites = 'sites', + Functions = 'functions', + Proxy = 'proxy', + Graphql = 'graphql', + Migrations = 'migrations', + Messaging = 'messaging', +} \ No newline at end of file diff --git a/src/enums/smtp-encryption.ts b/src/enums/smtp-encryption.ts new file mode 100644 index 00000000..876177b6 --- /dev/null +++ b/src/enums/smtp-encryption.ts @@ -0,0 +1,5 @@ +export enum SmtpEncryption { + None = 'none', + Ssl = 'ssl', + Tls = 'tls', +} \ No newline at end of file diff --git a/src/enums/status-code.ts b/src/enums/status-code.ts new file mode 100644 index 00000000..1f3adf8b --- /dev/null +++ b/src/enums/status-code.ts @@ -0,0 +1,6 @@ +export enum StatusCode { + MovedPermanently301 = '301', + Found302 = '302', + TemporaryRedirect307 = '307', + PermanentRedirect308 = '308', +} \ No newline at end of file diff --git a/src/enums/tables-db-index-type.ts b/src/enums/tables-db-index-type.ts new file mode 100644 index 00000000..a199cd9c --- /dev/null +++ b/src/enums/tables-db-index-type.ts @@ -0,0 +1,6 @@ +export enum TablesDBIndexType { + Key = 'key', + Fulltext = 'fulltext', + Unique = 'unique', + Spatial = 'spatial', +} \ No newline at end of file diff --git a/src/enums/template-reference-type.ts b/src/enums/template-reference-type.ts new file mode 100644 index 00000000..bd72cfb5 --- /dev/null +++ b/src/enums/template-reference-type.ts @@ -0,0 +1,5 @@ +export enum TemplateReferenceType { + Commit = 'commit', + Branch = 'branch', + Tag = 'tag', +} \ No newline at end of file diff --git a/src/enums/vcs-reference-type.ts b/src/enums/vcs-reference-type.ts new file mode 100644 index 00000000..cb5270f5 --- /dev/null +++ b/src/enums/vcs-reference-type.ts @@ -0,0 +1,5 @@ +export enum VCSReferenceType { + Branch = 'branch', + Commit = 'commit', + Tag = 'tag', +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 4041f75f..cfda66f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,15 +7,24 @@ */ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; +export { Activities } from './services/activities'; export { Avatars } from './services/avatars'; +export { Backups } from './services/backups'; export { Databases } from './services/databases'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; +export { Health } from './services/health'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; +export { Project } from './services/project'; +export { Proxy } from './services/proxy'; +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 { Users } from './services/users'; +export { Webhooks } from './services/webhooks'; export { Realtime } from './services/realtime'; export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; export type { RealtimeSubscription } from './services/realtime'; @@ -35,7 +44,49 @@ export { Theme } from './enums/theme'; export { Timezone } from './enums/timezone'; export { BrowserPermission } from './enums/browser-permission'; export { ImageFormat } from './enums/image-format'; +export { BackupServices } from './enums/backup-services'; +export { RelationshipType } from './enums/relationship-type'; +export { RelationMutate } from './enums/relation-mutate'; +export { DatabasesIndexType } from './enums/databases-index-type'; +export { OrderBy } from './enums/order-by'; +export { Runtime } from './enums/runtime'; +export { Scopes } from './enums/scopes'; +export { TemplateReferenceType } from './enums/template-reference-type'; +export { VCSReferenceType } from './enums/vcs-reference-type'; +export { DeploymentDownloadType } from './enums/deployment-download-type'; export { ExecutionMethod } from './enums/execution-method'; +export { Name } from './enums/name'; +export { MessagePriority } from './enums/message-priority'; +export { SmtpEncryption } from './enums/smtp-encryption'; +export { AuthMethod } from './enums/auth-method'; +export { Prompt } from './enums/prompt'; +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 { StatusCode } from './enums/status-code'; +export { ProxyResourceType } from './enums/proxy-resource-type'; +export { Framework } from './enums/framework'; +export { BuildRuntime } from './enums/build-runtime'; +export { Adapter } from './enums/adapter'; +export { Compression } from './enums/compression'; export { ImageGravity } from './enums/image-gravity'; +export { TablesDBIndexType } from './enums/tables-db-index-type'; +export { PasswordHash } from './enums/password-hash'; +export { MessagingProviderType } from './enums/messaging-provider-type'; +export { DatabaseType } from './enums/database-type'; +export { AttributeStatus } from './enums/attribute-status'; +export { ColumnStatus } from './enums/column-status'; +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'; +export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; +export { ProxyRuleStatus } from './enums/proxy-rule-status'; +export { MessageStatus } from './enums/message-status'; diff --git a/src/models.ts b/src/models.ts index a22d5b76..29e17a22 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,5 +1,17 @@ +import { DatabaseType } from "./enums/database-type" +import { AttributeStatus } from "./enums/attribute-status" +import { ColumnStatus } from "./enums/column-status" +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 { 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" +import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-resource-type" +import { ProxyRuleStatus } from "./enums/proxy-rule-status" +import { MessageStatus } from "./enums/message-status" /** * Appwrite Models @@ -36,6 +48,90 @@ export namespace Models { documents: Document[]; } + /** + * Tables List + */ + export type TableList = { + /** + * Total number of tables that matched your query. + */ + total: number; + /** + * List of tables. + */ + tables: Table[]; + } + + /** + * Collections List + */ + export type CollectionList = { + /** + * Total number of collections that matched your query. + */ + total: number; + /** + * List of collections. + */ + collections: Collection[]; + } + + /** + * Databases List + */ + export type DatabaseList = { + /** + * Total number of databases that matched your query. + */ + total: number; + /** + * List of databases. + */ + databases: Database[]; + } + + /** + * Indexes List + */ + export type IndexList = { + /** + * Total number of indexes that matched your query. + */ + total: number; + /** + * List of indexes. + */ + indexes: Index[]; + } + + /** + * Column Indexes List + */ + export type ColumnIndexList = { + /** + * Total number of indexes that matched your query. + */ + total: number; + /** + * List of indexes. + */ + indexes: ColumnIndex[]; + } + + /** + * Users List + */ + export type UserList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * Total number of users that matched your query. + */ + total: number; + /** + * List of users. + */ + users: User<Preferences>[]; + } + /** * Sessions List */ @@ -92,6 +188,34 @@ export namespace Models { files: File[]; } + /** + * Buckets List + */ + export type BucketList = { + /** + * Total number of buckets that matched your query. + */ + total: number; + /** + * List of buckets. + */ + buckets: Bucket[]; + } + + /** + * Resource Tokens List + */ + export type ResourceTokenList = { + /** + * Total number of tokens that matched your query. + */ + total: number; + /** + * List of tokens. + */ + tokens: ResourceToken[]; + } + /** * Teams List */ @@ -120,6 +244,76 @@ export namespace Models { memberships: Membership[]; } + /** + * Sites List + */ + export type SiteList = { + /** + * Total number of sites that matched your query. + */ + total: number; + /** + * List of sites. + */ + sites: Site[]; + } + + /** + * Functions List + */ + export type FunctionList = { + /** + * Total number of functions that matched your query. + */ + total: number; + /** + * List of functions. + */ + functions: Function[]; + } + + /** + * Frameworks List + */ + export type FrameworkList = { + /** + * Total number of frameworks that matched your query. + */ + total: number; + /** + * List of frameworks. + */ + frameworks: Framework[]; + } + + /** + * Runtimes List + */ + export type RuntimeList = { + /** + * Total number of runtimes that matched your query. + */ + total: number; + /** + * List of runtimes. + */ + runtimes: Runtime[]; + } + + /** + * Deployments List + */ + export type DeploymentList = { + /** + * Total number of deployments that matched your query. + */ + total: number; + /** + * List of deployments. + */ + deployments: Deployment[]; + } + /** * Executions List */ @@ -134,6 +328,34 @@ export namespace Models { executions: Execution[]; } + /** + * Webhooks List + */ + export type WebhookList = { + /** + * Total number of webhooks that matched your query. + */ + total: number; + /** + * List of webhooks. + */ + webhooks: Webhook[]; + } + + /** + * API Keys List + */ + export type KeyList = { + /** + * Total number of keys that matched your query. + */ + total: number; + /** + * List of keys. + */ + keys: Key[]; + } + /** * Countries List */ @@ -205,1191 +427,6531 @@ export namespace Models { } /** - * Locale codes list + * Variables List */ - export type LocaleCodeList = { + export type VariableList = { /** - * Total number of localeCodes that matched your query. + * Total number of variables that matched your query. */ total: number; /** - * List of localeCodes. + * List of variables. */ - localeCodes: LocaleCode[]; + variables: Variable[]; } /** - * Transaction List + * Mock Numbers List */ - export type TransactionList = { + export type MockNumberList = { /** - * Total number of transactions that matched your query. + * Total number of mockNumbers that matched your query. */ total: number; /** - * List of transactions. + * List of mockNumbers. */ - transactions: Transaction[]; + mockNumbers: MockNumber[]; } /** - * Row + * Policies List */ - export type Row = { - /** - * Row ID. - */ - $id: string; + export type PolicyList = { /** - * Row sequence ID. + * Total number of policies in the given project. */ - $sequence: string; + total: number; /** - * Table ID. + * List of policies. */ - $tableId: string; + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + } + + /** + * Email Templates List + */ + export type EmailTemplateList = { /** - * Database ID. + * Total number of templates that matched your query. */ - $databaseId: string; + total: number; /** - * Row creation date in ISO 8601 format. + * List of templates. */ - $createdAt: string; + templates: EmailTemplate[]; + } + + /** + * Status List + */ + export type HealthStatusList = { /** - * Row update date in ISO 8601 format. + * Total number of statuses that matched your query. */ - $updatedAt: string; + total: number; /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * List of statuses. */ - $permissions: string[]; + statuses: HealthStatus[]; } - export type DefaultRow = Row & { - [key: string]: any; - [__default]: true; - }; - /** - * Document + * Rule List */ - export type Document = { - /** - * Document ID. - */ - $id: string; + export type ProxyRuleList = { /** - * Document sequence ID. + * Total number of rules that matched your query. */ - $sequence: string; + total: number; /** - * Collection ID. + * List of rules. */ - $collectionId: string; + rules: ProxyRule[]; + } + + /** + * Locale codes list + */ + export type LocaleCodeList = { /** - * Database ID. + * Total number of localeCodes that matched your query. */ - $databaseId: string; + total: number; /** - * Document creation date in ISO 8601 format. + * List of localeCodes. */ - $createdAt: string; + localeCodes: LocaleCode[]; + } + + /** + * Provider list + */ + export type ProviderList = { /** - * Document update date in ISO 8601 format. + * Total number of providers that matched your query. */ - $updatedAt: string; + total: number; /** - * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * List of providers. */ - $permissions: string[]; + providers: Provider[]; } - export type DefaultDocument = Document & { - [key: string]: any; - [__default]: true; - }; - /** - * Log + * Message list */ - export type Log = { - /** - * Event name. - */ - event: string; + export type MessageList = { /** - * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + * Total number of messages that matched your query. */ - userId: string; + total: number; /** - * User email of the actor recorded for this log. During impersonation, this is the original impersonator. + * List of messages. */ - userEmail: string; + messages: Message[]; + } + + /** + * Topic list + */ + export type TopicList = { /** - * User name of the actor recorded for this log. During impersonation, this is the original impersonator. + * Total number of topics that matched your query. */ - userName: string; + total: number; /** - * API mode when event triggered. + * List of topics. */ - mode: string; + topics: Topic[]; + } + + /** + * Subscriber list + */ + export type SubscriberList = { /** - * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + * Total number of subscribers that matched your query. */ - userType: string; + total: number; /** - * IP session in use when the session was created. + * List of subscribers. */ - ip: string; + subscribers: Subscriber[]; + } + + /** + * Target list + */ + export type TargetList = { /** - * Log creation date in ISO 8601 format. + * Total number of targets that matched your query. */ - time: string; + total: number; /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * List of targets. */ - osCode: string; - /** - * Operating system name. - */ - osName: string; + targets: Target[]; + } + + /** + * Transaction List + */ + export type TransactionList = { /** - * Operating system version. + * Total number of transactions that matched your query. */ - osVersion: string; + total: number; /** - * Client type. + * List of transactions. */ - clientType: string; + transactions: Transaction[]; + } + + /** + * Specifications List + */ + export type SpecificationList = { /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * Total number of specifications that matched your query. */ - clientCode: string; + total: number; /** - * Client name. + * List of specifications. */ - clientName: string; + specifications: Specification[]; + } + + /** + * Database + */ + export type Database = { /** - * Client version. + * Database ID. */ - clientVersion: string; + $id: string; /** - * Client engine name. + * Database name. */ - clientEngine: string; + name: string; /** - * Client engine name. + * Database creation date in ISO 8601 format. */ - clientEngineVersion: string; + $createdAt: string; /** - * Device name. + * Database update date in ISO 8601 format. */ - deviceName: string; + $updatedAt: string; /** - * Device brand name. + * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. */ - deviceBrand: string; + enabled: boolean; /** - * Device model name. + * Database type. */ - deviceModel: string; + type: DatabaseType; /** - * Country two-character ISO 3166-1 alpha code. + * Database backup policies. */ - countryCode: string; + policies: Index[]; /** - * Country name. + * Database backup archives. */ - countryName: string; + archives: Collection[]; } /** - * User + * Collection */ - export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + export type Collection = { /** - * User ID. + * Collection ID. */ $id: string; /** - * User creation date in ISO 8601 format. + * Collection creation date in ISO 8601 format. */ $createdAt: string; /** - * User update date in ISO 8601 format. + * Collection update date in ISO 8601 format. */ $updatedAt: string; /** - * User name. + * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Database ID. + */ + databaseId: string; + /** + * Collection name. */ name: string; /** - * Hashed user password. + * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. */ - password?: string; + enabled: boolean; /** - * Password hashing algorithm. + * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - hash?: string; + documentSecurity: boolean; /** - * Password hashing algorithm configuration. + * Collection attributes. */ - hashOptions?: object; + attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; /** - * User registration date in ISO 8601 format. + * Collection indexes. */ - registration: string; + indexes: Index[]; /** - * User status. Pass `true` for enabled and `false` for disabled. + * Maximum document size in bytes. Returns 0 when no limit applies. */ - status: boolean; + bytesMax: number; /** - * Labels for the user. + * Currently used document size in bytes based on defined attributes. */ - labels: string[]; + bytesUsed: number; + } + + /** + * Attributes List + */ + export type AttributeList = { /** - * Password update time in ISO 8601 format. + * Total number of attributes in the given collection. */ - passwordUpdate: string; + total: number; /** - * User email address. + * List of attributes. */ - email: string; + attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; + } + + /** + * AttributeString + */ + export type AttributeString = { /** - * User phone number in E.164 format. + * Attribute Key. */ - phone: string; + key: string; /** - * Email verification status. + * Attribute type. */ - emailVerification: boolean; + type: string; /** - * Phone verification status. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - phoneVerification: boolean; + status: AttributeStatus; /** - * Multi factor authentication status. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - mfa: boolean; + error: string; /** - * User preferences as a key-value object + * Is attribute required? */ - prefs: Preferences; + required: boolean; /** - * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + * Is attribute an array? */ - targets: Target[]; + array?: boolean; /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + * Attribute creation date in ISO 8601 format. */ - accessedAt: string; + $createdAt: string; /** - * Whether the user can impersonate other users. + * Attribute update date in ISO 8601 format. */ - impersonator?: boolean; + $updatedAt: string; /** - * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + * Attribute size. */ - impersonatorUserId?: string; - } - - /** - * AlgoMD5 - */ - export type AlgoMd5 = { + size: number; /** - * Algo type. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - type: string; - } - - /** - * AlgoSHA - */ - export type AlgoSha = { + default?: string; /** - * Algo type. + * Defines whether this attribute is encrypted or not. */ - type: string; + encrypt?: boolean; } /** - * AlgoPHPass + * AttributeInteger */ - export type AlgoPhpass = { + export type AttributeInteger = { /** - * Algo type. + * Attribute Key. */ - type: string; - } - - /** - * AlgoBcrypt - */ - export type AlgoBcrypt = { + key: string; /** - * Algo type. + * Attribute type. */ type: string; - } - - /** - * AlgoScrypt - */ - export type AlgoScrypt = { /** - * Algo type. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - type: string; + status: AttributeStatus; /** - * CPU complexity of computed hash. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - costCpu: number; + error: string; /** - * Memory complexity of computed hash. + * Is attribute required? */ - costMemory: number; + required: boolean; /** - * Parallelization of computed hash. + * Is attribute an array? */ - costParallel: number; + array?: boolean; /** - * Length used to compute hash. + * Attribute creation date in ISO 8601 format. */ - length: number; - } - - /** - * AlgoScryptModified - */ - export type AlgoScryptModified = { + $createdAt: string; /** - * Algo type. + * Attribute update date in ISO 8601 format. */ - type: string; + $updatedAt: string; /** - * Salt used to compute hash. + * Minimum value to enforce for new documents. */ - salt: string; + min?: number | bigint; /** - * Separator used to compute hash. + * Maximum value to enforce for new documents. */ - saltSeparator: string; + max?: number | bigint; /** - * Key used to compute hash. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - signerKey: string; + default?: number; } /** - * AlgoArgon2 + * AttributeBigInt */ - export type AlgoArgon2 = { + export type AttributeBigint = { /** - * Algo type. + * Attribute Key. + */ + key: string; + /** + * Attribute type. */ type: string; /** - * Memory used to compute hash. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - memoryCost: number; + status: AttributeStatus; /** - * Amount of time consumed to compute hash + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - timeCost: number; + error: string; /** - * Number of threads used to compute hash. + * Is attribute required? */ - threads: number; - } - - /** - * Preferences - */ - export type Preferences = { - } - - export type DefaultPreferences = Preferences & { - [key: string]: any; - [__default]: true; - }; - - /** - * Session - */ - export type Session = { + required: boolean; /** - * Session ID. + * Is attribute an array? */ - $id: string; + array?: boolean; /** - * Session creation date in ISO 8601 format. + * Attribute creation date in ISO 8601 format. */ $createdAt: string; /** - * Session update date in ISO 8601 format. + * Attribute update date in ISO 8601 format. */ $updatedAt: string; /** - * User ID. + * Minimum value to enforce for new documents. */ - userId: string; + min?: number | bigint; /** - * Session expiration date in ISO 8601 format. + * Maximum value to enforce for new documents. */ - expire: string; + max?: number | bigint; /** - * Session Provider. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - provider: string; + default?: number | bigint; + } + + /** + * AttributeFloat + */ + export type AttributeFloat = { /** - * Session Provider User ID. + * Attribute Key. */ - providerUid: string; + key: string; /** - * Session Provider Access Token. + * Attribute type. */ - providerAccessToken: string; + type: string; /** - * The date of when the access token expires in ISO 8601 format. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - providerAccessTokenExpiry: string; + status: AttributeStatus; /** - * Session Provider Refresh Token. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - providerRefreshToken: string; + error: string; /** - * IP in use when the session was created. + * Is attribute required? */ - ip: string; + required: boolean; /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * Is attribute an array? */ - osCode: string; + array?: boolean; /** - * Operating system name. + * Attribute creation date in ISO 8601 format. */ - osName: string; + $createdAt: string; /** - * Operating system version. + * Attribute update date in ISO 8601 format. */ - osVersion: string; + $updatedAt: string; /** - * Client type. + * Minimum value to enforce for new documents. */ - clientType: string; + min?: number; /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * Maximum value to enforce for new documents. */ - clientCode: string; + max?: number; /** - * Client name. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - clientName: string; + default?: number; + } + + /** + * AttributeBoolean + */ + export type AttributeBoolean = { /** - * Client version. + * Attribute Key. */ - clientVersion: string; + key: string; /** - * Client engine name. + * Attribute type. */ - clientEngine: string; + type: string; /** - * Client engine name. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - clientEngineVersion: string; + status: AttributeStatus; /** - * Device name. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - deviceName: string; + error: string; /** - * Device brand name. + * Is attribute required? */ - deviceBrand: string; + required: boolean; /** - * Device model name. + * Is attribute an array? */ - deviceModel: string; + array?: boolean; /** - * Country two-character ISO 3166-1 alpha code. + * Attribute creation date in ISO 8601 format. */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - /** - * Returns true if this the current user session. - */ - current: boolean; - /** - * Returns a list of active session factors. - */ - factors: string[]; + $createdAt: string; /** - * Secret used to authenticate the user. Only included if the request was made with an API key + * Attribute update date in ISO 8601 format. */ - secret: string; + $updatedAt: string; /** - * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - mfaUpdatedAt: string; + default?: boolean; } /** - * Identity + * AttributeEmail */ - export type Identity = { + export type AttributeEmail = { /** - * Identity ID. + * Attribute Key. */ - $id: string; + key: string; /** - * Identity creation date in ISO 8601 format. + * Attribute type. */ - $createdAt: string; + type: string; /** - * Identity update date in ISO 8601 format. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - $updatedAt: string; + status: AttributeStatus; /** - * User ID. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - userId: string; + error: string; /** - * Identity Provider. + * Is attribute required? */ - provider: string; + required: boolean; /** - * ID of the User in the Identity Provider. + * Is attribute an array? */ - providerUid: string; + array?: boolean; /** - * Email of the User in the Identity Provider. + * Attribute creation date in ISO 8601 format. */ - providerEmail: string; + $createdAt: string; /** - * Identity Provider Access Token. + * Attribute update date in ISO 8601 format. */ - providerAccessToken: string; + $updatedAt: string; /** - * The date of when the access token expires in ISO 8601 format. + * String format. */ - providerAccessTokenExpiry: string; + format: string; /** - * Identity Provider Refresh Token. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - providerRefreshToken: string; + default?: string; } /** - * Token + * AttributeEnum */ - export type Token = { + export type AttributeEnum = { /** - * Token ID. + * Attribute Key. */ - $id: string; + key: string; /** - * Token creation date in ISO 8601 format. + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. */ $createdAt: string; /** - * User ID. + * Attribute update date in ISO 8601 format. */ - userId: string; + $updatedAt: string; /** - * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + * Array of elements in enumerated type. */ - secret: string; + elements: string[]; /** - * Token expiration date in ISO 8601 format. + * String format. */ - expire: string; + format: string; /** - * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - phrase: string; + default?: string; } /** - * JWT + * AttributeIP */ - export type Jwt = { + export type AttributeIp = { /** - * JWT encoded string. + * Attribute Key. */ - jwt: string; - } - - /** - * Locale - */ - export type Locale = { + key: string; /** - * User IP address. + * Attribute type. */ - ip: string; + type: string; /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - countryCode: string; + status: AttributeStatus; /** - * Country name. This field support localization. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - country: string; + error: string; /** - * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + * Is attribute required? */ - continentCode: string; + required: boolean; /** - * Continent name. This field support localization. + * Is attribute an array? */ - continent: string; + array?: boolean; /** - * True if country is part of the European Union. + * Attribute creation date in ISO 8601 format. */ - eu: boolean; + $createdAt: string; /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + * Attribute update date in ISO 8601 format. */ - currency: string; - } - - /** - * LocaleCode - */ - export type LocaleCode = { + $updatedAt: string; /** - * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + * String format. */ - code: string; + format: string; /** - * Locale name + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - name: string; + default?: string; } /** - * File + * AttributeURL */ - export type File = { + export type AttributeUrl = { /** - * File ID. + * Attribute Key. */ - $id: string; + key: string; /** - * Bucket ID. + * Attribute type. */ - bucketId: string; + type: string; /** - * File creation date in ISO 8601 format. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - $createdAt: string; + status: AttributeStatus; /** - * File update date in ISO 8601 format. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - $updatedAt: string; + error: string; /** - * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * Is attribute required? */ - $permissions: string[]; + required: boolean; /** - * File name. + * Is attribute an array? */ - name: string; + array?: boolean; /** - * File MD5 signature. + * Attribute creation date in ISO 8601 format. */ - signature: string; + $createdAt: string; /** - * File mime type. + * Attribute update date in ISO 8601 format. */ - mimeType: string; + $updatedAt: string; /** - * File original size in bytes. + * String format. */ - sizeOriginal: number; + format: string; /** - * Total number of chunks available + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - chunksTotal: number; + default?: string; + } + + /** + * AttributeDatetime + */ + export type AttributeDatetime = { /** - * Total number of chunks uploaded + * Attribute Key. */ - chunksUploaded: number; + key: string; /** - * Whether file contents are encrypted at rest. + * Attribute type. */ - encryption: boolean; + type: string; /** - * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - compression: string; - } - - /** - * Team - */ - export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + status: AttributeStatus; /** - * Team ID. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - $id: string; + error: string; /** - * Team creation date in ISO 8601 format. + * Is attribute required? */ - $createdAt: string; + required: boolean; /** - * Team update date in ISO 8601 format. + * Is attribute an array? */ - $updatedAt: string; + array?: boolean; /** - * Team name. + * Attribute creation date in ISO 8601 format. */ - name: string; + $createdAt: string; /** - * Total number of team members. + * Attribute update date in ISO 8601 format. */ - total: number; + $updatedAt: string; /** - * Team preferences as a key-value object + * ISO 8601 format. */ - prefs: Preferences; + format: string; + /** + * Default value for attribute when not provided. Only null is optional + */ + default?: string; } /** - * Membership + * AttributeRelationship */ - export type Membership = { + export type AttributeRelationship = { /** - * Membership ID. + * Attribute Key. */ - $id: string; + key: string; /** - * Membership creation date in ISO 8601 format. + * Attribute type. */ - $createdAt: string; + type: string; /** - * Membership update date in ISO 8601 format. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - $updatedAt: string; + status: AttributeStatus; /** - * User ID. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - userId: string; + error: string; /** - * User name. Hide this attribute by toggling membership privacy in the Console. + * Is attribute required? */ - userName: string; + required: boolean; /** - * User email address. Hide this attribute by toggling membership privacy in the Console. + * Is attribute an array? */ - userEmail: string; + array?: boolean; /** - * User phone number. Hide this attribute by toggling membership privacy in the Console. + * Attribute creation date in ISO 8601 format. */ - userPhone: string; + $createdAt: string; /** - * Team ID. + * Attribute update date in ISO 8601 format. */ - teamId: string; + $updatedAt: string; /** - * Team name. + * The ID of the related collection. */ - teamName: string; + relatedCollection: string; /** - * Date, the user has been invited to join the team in ISO 8601 format. + * The type of the relationship. */ - invited: string; + relationType: string; /** - * Date, the user has accepted the invitation to join the team in ISO 8601 format. + * Is the relationship two-way? */ - joined: string; + twoWay: boolean; /** - * User confirmation status, true if the user has joined the team or false otherwise. + * The key of the two-way relationship. */ - confirm: boolean; + twoWayKey: string; /** - * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + * How deleting the parent document will propagate to child documents. */ - mfa: boolean; + onDelete: string; /** - * User list of roles + * Whether this is the parent or child side of the relationship */ - roles: string[]; + side: string; } /** - * Execution + * AttributePoint */ - export type Execution = { + export type AttributePoint = { /** - * Execution ID. + * Attribute Key. */ - $id: string; + key: string; /** - * Execution creation date in ISO 8601 format. + * Attribute type. */ - $createdAt: string; + type: string; /** - * Execution update date in ISO 8601 format. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - $updatedAt: string; + status: AttributeStatus; /** - * Execution roles. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - $permissions: string[]; + error: string; /** - * Function ID. + * Is attribute required? */ - functionId: string; + required: boolean; /** - * Function's deployment ID used to create the execution. + * Is attribute an array? */ - deploymentId: string; + array?: boolean; /** - * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + * Attribute creation date in ISO 8601 format. */ - trigger: ExecutionTrigger; + $createdAt: string; /** - * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + * Attribute update date in ISO 8601 format. */ - status: ExecutionStatus; + $updatedAt: string; /** - * HTTP request method type. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - requestMethod: string; + default?: any[]; + } + + /** + * AttributeLine + */ + export type AttributeLine = { /** - * HTTP request path and query. + * Attribute Key. */ - requestPath: string; + key: string; /** - * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + * Attribute type. */ - requestHeaders: Headers[]; + type: string; /** - * HTTP response status code. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - responseStatusCode: number; + status: AttributeStatus; /** - * HTTP response body. This will return empty unless execution is created as synchronous. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - responseBody: string; + error: string; /** - * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + * Is attribute required? */ - responseHeaders: Headers[]; + required: boolean; /** - * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + * Is attribute an array? */ - logs: string; + array?: boolean; /** - * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + * Attribute creation date in ISO 8601 format. */ - errors: string; + $createdAt: string; /** - * Resource(function/site) execution duration in seconds. + * Attribute update date in ISO 8601 format. */ - duration: number; + $updatedAt: string; /** - * The scheduled time for execution. If left empty, execution will be queued immediately. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - scheduledAt?: string; + default?: any[]; } /** - * Country + * AttributePolygon */ - export type Country = { + export type AttributePolygon = { /** - * Country name. + * Attribute Key. */ - name: string; + key: string; /** - * Country two-character ISO 3166-1 alpha code. + * Attribute type. */ - code: string; - } - - /** - * Continent - */ - export type Continent = { + type: string; /** - * Continent name. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - name: string; + status: AttributeStatus; /** - * Continent two letter code. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - code: string; + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: any[]; } /** - * Language + * AttributeVarchar */ - export type Language = { + export type AttributeVarchar = { /** - * Language name. + * Attribute Key. */ - name: string; + key: string; /** - * Language two-character ISO 639-1 codes. + * Attribute type. */ - code: string; + type: string; /** - * Language native name. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - nativeName: string; + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Attribute size. + */ + size: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** - * Currency + * AttributeText */ - export type Currency = { + export type AttributeText = { /** - * Currency symbol. + * Attribute Key. */ - symbol: string; + key: string; /** - * Currency name. + * Attribute type. */ - name: string; + type: string; /** - * Currency native symbol. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - symbolNative: string; + status: AttributeStatus; /** - * Number of decimal digits. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - decimalDigits: number; + error: string; /** - * Currency digit rounding. + * Is attribute required? */ - rounding: number; + required: boolean; /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + * Is attribute an array? */ - code: string; + array?: boolean; /** - * Currency plural name + * Attribute creation date in ISO 8601 format. */ - namePlural: string; + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** - * Phone + * AttributeMediumtext */ - export type Phone = { + export type AttributeMediumtext = { /** - * Phone code. + * Attribute Key. */ - code: string; + key: string; /** - * Country two-character ISO 3166-1 alpha code. + * Attribute type. */ - countryCode: string; + type: string; /** - * Country name. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - countryName: string; + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** - * Headers + * AttributeLongtext */ - export type Headers = { + export type AttributeLongtext = { /** - * Header name. + * Attribute Key. */ - name: string; + key: string; /** - * Header value. + * Attribute type. */ - value: string; + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** - * MFA Challenge + * Table */ - export type MfaChallenge = { + export type Table = { /** - * Token ID. + * Table ID. */ $id: string; /** - * Token creation date in ISO 8601 format. + * Table creation date in ISO 8601 format. */ $createdAt: string; /** - * User ID. + * Table update date in ISO 8601 format. */ - userId: string; + $updatedAt: string; /** - * Token expiration date in ISO 8601 format. + * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - expire: string; - } - - /** - * MFA Recovery Codes - */ - export type MfaRecoveryCodes = { + $permissions: string[]; /** - * Recovery codes. + * Database ID. */ - recoveryCodes: string[]; + databaseId: string; + /** + * Table name. + */ + name: string; + /** + * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + enabled: boolean; + /** + * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + rowSecurity: boolean; + /** + * Table columns. + */ + columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; + /** + * Table indexes. + */ + indexes: ColumnIndex[]; + /** + * Maximum row size in bytes. Returns 0 when no limit applies. + */ + bytesMax: number; + /** + * Currently used row size in bytes based on defined columns. + */ + bytesUsed: number; } /** - * MFAType + * Columns List */ - export type MfaType = { + export type ColumnList = { /** - * Secret token used for TOTP factor. + * Total number of columns in the given table. */ - secret: string; + total: number; /** - * URI for authenticator apps. + * List of columns. */ - uri: string; + columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; } /** - * MFAFactors + * ColumnString */ - export type MfaFactors = { + export type ColumnString = { /** - * Can TOTP be used for MFA challenge for this account. + * Column Key. */ - totp: boolean; + key: string; /** - * Can phone (SMS) be used for MFA challenge for this account. + * Column type. */ - phone: boolean; + type: string; /** - * Can email be used for MFA challenge for this account. + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - email: boolean; + status: ColumnStatus; /** - * Can recovery code be used for MFA challenge for this account. + * Error message. Displays error generated on failure of creating or deleting an column. */ - recoveryCode: boolean; - } - - /** - * Transaction - */ - export type Transaction = { + error: string; /** - * Transaction ID. + * Is column required? */ - $id: string; + required: boolean; /** - * Transaction creation time in ISO 8601 format. + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. */ $createdAt: string; /** - * Transaction update date in ISO 8601 format. + * Column update date in ISO 8601 format. */ $updatedAt: string; /** - * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + * Column size. */ - status: string; + size: number; /** - * Number of operations in the transaction. + * Default value for column when not provided. Cannot be set when column is required. */ - operations: number; + default?: string; /** - * Expiration time in ISO 8601 format. + * Defines whether this column is encrypted or not. */ - expiresAt: string; + encrypt?: boolean; } /** - * Subscriber + * ColumnInteger */ - export type Subscriber = { + export type ColumnInteger = { /** - * Subscriber ID. + * Column Key. */ - $id: string; + key: string; /** - * Subscriber creation time in ISO 8601 format. + * Column type. */ - $createdAt: string; + type: string; /** - * Subscriber update date in ISO 8601 format. + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - $updatedAt: string; + status: ColumnStatus; /** - * Target ID. + * Error message. Displays error generated on failure of creating or deleting an column. */ - targetId: string; + error: string; /** - * Target. + * Is column required? */ - target: Target; + required: boolean; /** - * Topic ID. + * Is column an array? */ - userId: string; + array?: boolean; /** - * User Name. + * Column creation date in ISO 8601 format. */ - userName: string; + $createdAt: string; /** - * Topic ID. + * Column update date in ISO 8601 format. */ - topicId: string; + $updatedAt: string; /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. + * Minimum value to enforce for new documents. */ - providerType: string; + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number; } /** - * Target + * ColumnBigInt */ - export type Target = { + export type ColumnBigint = { /** - * Target ID. + * Column Key. */ - $id: string; + key: string; /** - * Target creation time in ISO 8601 format. + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. */ $createdAt: string; /** - * Target update date in ISO 8601 format. + * Column update date in ISO 8601 format. */ $updatedAt: string; /** - * Target Name. + * Minimum value to enforce for new documents. */ - name: string; + min?: number | bigint; /** - * User ID. + * Maximum value to enforce for new documents. */ - userId: string; + max?: number | bigint; /** - * Provider ID. + * Default value for column when not provided. Cannot be set when column is required. */ - providerId?: string; + default?: number | bigint; + } + + /** + * ColumnFloat + */ + export type ColumnFloat = { /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. + * Column Key. */ - providerType: string; + key: string; /** - * The target identifier. + * Column type. */ - identifier: string; + type: string; /** - * Is the target expired. + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - expired: boolean; + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number; + /** + * Maximum value to enforce for new documents. + */ + max?: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number; + } + + /** + * ColumnBoolean + */ + export type ColumnBoolean = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: boolean; + } + + /** + * ColumnEmail + */ + export type ColumnEmail = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnEnum + */ + export type ColumnEnum = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Array of elements in enumerated type. + */ + elements: string[]; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnIP + */ + export type ColumnIp = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnURL + */ + export type ColumnUrl = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnDatetime + */ + export type ColumnDatetime = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ISO 8601 format. + */ + format: string; + /** + * Default value for column when not provided. Only null is optional + */ + default?: string; + } + + /** + * ColumnRelationship + */ + export type ColumnRelationship = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The ID of the related table. + */ + relatedTable: string; + /** + * The type of the relationship. + */ + relationType: string; + /** + * Is the relationship two-way? + */ + twoWay: boolean; + /** + * The key of the two-way relationship. + */ + twoWayKey: string; + /** + * How deleting the parent document will propagate to child documents. + */ + onDelete: string; + /** + * Whether this is the parent or child side of the relationship + */ + side: string; + } + + /** + * ColumnPoint + */ + export type ColumnPoint = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnLine + */ + export type ColumnLine = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnPolygon + */ + export type ColumnPolygon = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnVarchar + */ + export type ColumnVarchar = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Column size. + */ + size: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnText + */ + export type ColumnText = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnMediumtext + */ + export type ColumnMediumtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnLongtext + */ + export type ColumnLongtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * Index + */ + export type Index = { + /** + * Index ID. + */ + $id: string; + /** + * Index creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Index update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Index key. + */ + key: string; + /** + * Index type. + */ + type: string; + /** + * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: IndexStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** + * Index attributes. + */ + attributes: string[]; + /** + * Index attributes length. + */ + lengths: number[]; + /** + * Index orders. + */ + orders?: string[]; + } + + /** + * Index + */ + export type ColumnIndex = { + /** + * Index ID. + */ + $id: string; + /** + * Index creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Index update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Index Key. + */ + key: string; + /** + * Index type. + */ + type: string; + /** + * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** + * Index columns. + */ + columns: string[]; + /** + * Index columns length. + */ + lengths: number[]; + /** + * Index orders. + */ + orders?: string[]; + } + + /** + * Row + */ + export type Row = { + /** + * Row ID. + */ + $id: string; + /** + * Row sequence ID. + */ + $sequence: string; + /** + * Table ID. + */ + $tableId: string; + /** + * Database ID. + */ + $databaseId: string; + /** + * Row creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Row update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + } + + export type DefaultRow = Row & { + [key: string]: any; + [__default]: true; + }; + + /** + * Document + */ + export type Document = { + /** + * Document ID. + */ + $id: string; + /** + * Document sequence ID. + */ + $sequence: string; + /** + * Collection ID. + */ + $collectionId: string; + /** + * Database ID. + */ + $databaseId: string; + /** + * Document creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Document update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + } + + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; + + /** + * Log + */ + export type Log = { + /** + * Event name. + */ + event: string; + /** + * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + */ + userId: string; + /** + * User email of the actor recorded for this log. During impersonation, this is the original impersonator. + */ + userEmail: string; + /** + * User name of the actor recorded for this log. During impersonation, this is the original impersonator. + */ + userName: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + */ + userType: string; + /** + * IP session in use when the session was created. + */ + ip: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * User + */ + export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * User ID. + */ + $id: string; + /** + * User creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User name. + */ + name: string; + /** + * Hashed user password. + */ + password?: string; + /** + * Password hashing algorithm. + */ + hash?: string; + /** + * Password hashing algorithm configuration. + */ + hashOptions?: object; + /** + * User registration date in ISO 8601 format. + */ + registration: string; + /** + * User status. Pass `true` for enabled and `false` for disabled. + */ + status: boolean; + /** + * Labels for the user. + */ + labels: string[]; + /** + * Password update time in ISO 8601 format. + */ + passwordUpdate: string; + /** + * User email address. + */ + email: string; + /** + * User phone number in E.164 format. + */ + phone: string; + /** + * Email verification status. + */ + emailVerification: boolean; + /** + * Phone verification status. + */ + phoneVerification: boolean; + /** + * Multi factor authentication status. + */ + mfa: boolean; + /** + * User preferences as a key-value object + */ + prefs: Preferences; + /** + * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + */ + targets: Target[]; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * Whether the user can impersonate other users. + */ + impersonator?: boolean; + /** + * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + impersonatorUserId?: string; + } + + /** + * AlgoMD5 + */ + export type AlgoMd5 = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoSHA + */ + export type AlgoSha = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoPHPass + */ + export type AlgoPhpass = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoBcrypt + */ + export type AlgoBcrypt = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoScrypt + */ + export type AlgoScrypt = { + /** + * Algo type. + */ + type: string; + /** + * CPU complexity of computed hash. + */ + costCpu: number; + /** + * Memory complexity of computed hash. + */ + costMemory: number; + /** + * Parallelization of computed hash. + */ + costParallel: number; + /** + * Length used to compute hash. + */ + length: number; + } + + /** + * AlgoScryptModified + */ + export type AlgoScryptModified = { + /** + * Algo type. + */ + type: string; + /** + * Salt used to compute hash. + */ + salt: string; + /** + * Separator used to compute hash. + */ + saltSeparator: string; + /** + * Key used to compute hash. + */ + signerKey: string; + } + + /** + * AlgoArgon2 + */ + export type AlgoArgon2 = { + /** + * Algo type. + */ + type: string; + /** + * Memory used to compute hash. + */ + memoryCost: number; + /** + * Amount of time consumed to compute hash + */ + timeCost: number; + /** + * Number of threads used to compute hash. + */ + threads: number; + } + + /** + * Preferences + */ + export type Preferences = { + } + + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + + /** + * Session + */ + export type Session = { + /** + * Session ID. + */ + $id: string; + /** + * Session creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Session update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * Session expiration date in ISO 8601 format. + */ + expire: string; + /** + * Session Provider. + */ + provider: string; + /** + * Session Provider User ID. + */ + providerUid: string; + /** + * Session Provider Access Token. + */ + providerAccessToken: string; + /** + * The date of when the access token expires in ISO 8601 format. + */ + providerAccessTokenExpiry: string; + /** + * Session Provider Refresh Token. + */ + providerRefreshToken: string; + /** + * IP in use when the session was created. + */ + ip: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + /** + * Returns true if this the current user session. + */ + current: boolean; + /** + * Returns a list of active session factors. + */ + factors: string[]; + /** + * Secret used to authenticate the user. Only included if the request was made with an API key + */ + secret: string; + /** + * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + */ + mfaUpdatedAt: string; + } + + /** + * Identity + */ + export type Identity = { + /** + * Identity ID. + */ + $id: string; + /** + * Identity creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Identity update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * Identity Provider. + */ + provider: string; + /** + * ID of the User in the Identity Provider. + */ + providerUid: string; + /** + * Email of the User in the Identity Provider. + */ + providerEmail: string; + /** + * Identity Provider Access Token. + */ + providerAccessToken: string; + /** + * The date of when the access token expires in ISO 8601 format. + */ + providerAccessTokenExpiry: string; + /** + * Identity Provider Refresh Token. + */ + providerRefreshToken: string; + } + + /** + * Token + */ + export type Token = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User ID. + */ + userId: string; + /** + * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + secret: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + /** + * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + */ + phrase: string; + } + + /** + * JWT + */ + export type Jwt = { + /** + * JWT encoded string. + */ + jwt: string; + } + + /** + * Locale + */ + export type Locale = { + /** + * User IP address. + */ + ip: string; + /** + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + */ + countryCode: string; + /** + * Country name. This field support localization. + */ + country: string; + /** + * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + */ + continentCode: string; + /** + * Continent name. This field support localization. + */ + continent: string; + /** + * True if country is part of the European Union. + */ + eu: boolean; + /** + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + */ + currency: string; + } + + /** + * LocaleCode + */ + export type LocaleCode = { + /** + * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + */ + code: string; + /** + * Locale name + */ + name: string; + } + + /** + * File + */ + export type File = { + /** + * File ID. + */ + $id: string; + /** + * Bucket ID. + */ + bucketId: string; + /** + * File creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * File update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * File name. + */ + name: string; + /** + * File MD5 signature. + */ + signature: string; + /** + * File mime type. + */ + mimeType: string; + /** + * File original size in bytes. + */ + sizeOriginal: number; + /** + * Total number of chunks available + */ + chunksTotal: number; + /** + * Total number of chunks uploaded + */ + chunksUploaded: number; + /** + * Whether file contents are encrypted at rest. + */ + encryption: boolean; + /** + * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + */ + compression: string; + } + + /** + * Bucket + */ + export type Bucket = { + /** + * Bucket ID. + */ + $id: string; + /** + * Bucket creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Bucket update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + fileSecurity: boolean; + /** + * Bucket name. + */ + name: string; + /** + * Bucket enabled. + */ + enabled: boolean; + /** + * Maximum file size supported. + */ + maximumFileSize: number; + /** + * Allowed file extensions. + */ + allowedFileExtensions: string[]; + /** + * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + */ + compression: string; + /** + * Bucket is encrypted. + */ + encryption: boolean; + /** + * Virus scanning is enabled. + */ + antivirus: boolean; + /** + * Image transformations are enabled. + */ + transformations: boolean; + /** + * Total size of this bucket in bytes. + */ + totalSize: number; + } + + /** + * ResourceToken + */ + export type ResourceToken = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + /** + * JWT encoded string. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + } + + /** + * Team + */ + export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * Team ID. + */ + $id: string; + /** + * Team creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Team update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Team name. + */ + name: string; + /** + * Total number of team members. + */ + total: number; + /** + * Team preferences as a key-value object + */ + prefs: Preferences; + } + + /** + * Membership + */ + export type Membership = { + /** + * Membership ID. + */ + $id: string; + /** + * Membership creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Membership update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * User name. Hide this attribute by toggling membership privacy in the Console. + */ + userName: string; + /** + * User email address. Hide this attribute by toggling membership privacy in the Console. + */ + userEmail: string; + /** + * User phone number. Hide this attribute by toggling membership privacy in the Console. + */ + userPhone: string; + /** + * Team ID. + */ + teamId: string; + /** + * Team name. + */ + teamName: string; + /** + * Date, the user has been invited to join the team in ISO 8601 format. + */ + invited: string; + /** + * Date, the user has accepted the invitation to join the team in ISO 8601 format. + */ + joined: string; + /** + * User confirmation status, true if the user has joined the team or false otherwise. + */ + confirm: boolean; + /** + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + */ + mfa: boolean; + /** + * User list of roles + */ + roles: string[]; + } + + /** + * Site + */ + export type Site = { + /** + * Site ID. + */ + $id: string; + /** + * Site creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Site update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Site name. + */ + name: string; + /** + * Site enabled. + */ + enabled: boolean; + /** + * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. + */ + live: boolean; + /** + * When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + */ + logging: boolean; + /** + * Site framework. + */ + framework: string; + /** + * How many days to keep the non-active deployments before they will be automatically deleted. + */ + deploymentRetention: number; + /** + * Site's active deployment ID. + */ + deploymentId: string; + /** + * Active deployment creation date in ISO 8601 format. + */ + deploymentCreatedAt: string; + /** + * Screenshot of active deployment with light theme preference file ID. + */ + deploymentScreenshotLight: string; + /** + * Screenshot of active deployment with dark theme preference file ID. + */ + deploymentScreenshotDark: string; + /** + * Site's latest deployment ID. + */ + latestDeploymentId: string; + /** + * Latest deployment creation date in ISO 8601 format. + */ + latestDeploymentCreatedAt: string; + /** + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + */ + latestDeploymentStatus: string; + /** + * Site variables. + */ + vars: Variable[]; + /** + * Site request timeout in seconds. + */ + timeout: number; + /** + * The install command used to install the site dependencies. + */ + installCommand: string; + /** + * The build command used to build the site. + */ + buildCommand: string; + /** + * Custom command to use when starting site runtime. + */ + startCommand: string; + /** + * The directory where the site build output is located. + */ + outputDirectory: string; + /** + * Site VCS (Version Control System) installation id. + */ + installationId: string; + /** + * VCS (Version Control System) Repository ID + */ + providerRepositoryId: string; + /** + * VCS (Version Control System) branch name + */ + providerBranch: string; + /** + * Path to site in VCS (Version Control System) repository + */ + providerRootDirectory: string; + /** + * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + */ + providerSilentMode: boolean; + /** + * Machine specification for deployment builds. + */ + buildSpecification: string; + /** + * Machine specification for SSR executions. + */ + runtimeSpecification: string; + /** + * Site build runtime. + */ + buildRuntime: string; + /** + * Site framework adapter. + */ + adapter: string; + /** + * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + */ + fallbackFile: string; + } + + /** + * Function + */ + export type Function = { + /** + * Function ID. + */ + $id: string; + /** + * Function creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Function update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Execution permissions. + */ + execute: string[]; + /** + * Function name. + */ + name: string; + /** + * Function enabled. + */ + enabled: boolean; + /** + * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. + */ + live: boolean; + /** + * When disabled, executions will exclude logs and errors, and will be slightly faster. + */ + logging: boolean; + /** + * Function execution and build runtime. + */ + runtime: string; + /** + * How many days to keep the non-active deployments before they will be automatically deleted. + */ + deploymentRetention: number; + /** + * Function's active deployment ID. + */ + deploymentId: string; + /** + * Active deployment creation date in ISO 8601 format. + */ + deploymentCreatedAt: string; + /** + * Function's latest deployment ID. + */ + latestDeploymentId: string; + /** + * Latest deployment creation date in ISO 8601 format. + */ + latestDeploymentCreatedAt: string; + /** + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + */ + latestDeploymentStatus: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Function variables. + */ + vars: Variable[]; + /** + * Function trigger events. + */ + events: string[]; + /** + * Function execution schedule in CRON format. + */ + schedule: string; + /** + * Function execution timeout in seconds. + */ + timeout: number; + /** + * The entrypoint file used to execute the deployment. + */ + entrypoint: string; + /** + * The build command used to build the deployment. + */ + commands: string; + /** + * Version of Open Runtimes used for the function. + */ + version: string; + /** + * Function VCS (Version Control System) installation id. + */ + installationId: string; + /** + * VCS (Version Control System) Repository ID + */ + providerRepositoryId: string; + /** + * VCS (Version Control System) branch name + */ + providerBranch: string; + /** + * Path to function in VCS (Version Control System) repository + */ + providerRootDirectory: string; + /** + * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + */ + providerSilentMode: boolean; + /** + * Machine specification for deployment builds. + */ + buildSpecification: string; + /** + * Machine specification for executions. + */ + runtimeSpecification: string; + } + + /** + * Runtime + */ + export type Runtime = { + /** + * Runtime ID. + */ + $id: string; + /** + * Parent runtime key. + */ + key: string; + /** + * Runtime Name. + */ + name: string; + /** + * Runtime version. + */ + version: string; + /** + * Base Docker image used to build the runtime. + */ + base: string; + /** + * Image name of Docker Hub. + */ + image: string; + /** + * Name of the logo image. + */ + logo: string; + /** + * List of supported architectures. + */ + supports: string[]; + } + + /** + * Framework + */ + export type Framework = { + /** + * Framework key. + */ + key: string; + /** + * Framework Name. + */ + name: string; + /** + * Default runtime version. + */ + buildRuntime: string; + /** + * List of supported runtime versions. + */ + runtimes: string[]; + /** + * List of supported adapters. + */ + adapters: FrameworkAdapter[]; + } + + /** + * Framework Adapter + */ + export type FrameworkAdapter = { + /** + * Adapter key. + */ + key: string; + /** + * Default command to download dependencies. + */ + installCommand: string; + /** + * Default command to build site into output directory. + */ + buildCommand: string; + /** + * Default output directory of build. + */ + outputDirectory: string; + /** + * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + */ + fallbackFile: string; + } + + /** + * Deployment + */ + export type Deployment = { + /** + * Deployment ID. + */ + $id: string; + /** + * Deployment creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Deployment update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Type of deployment. + */ + type: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource type. + */ + resourceType: string; + /** + * The entrypoint file to use to execute the deployment code. + */ + entrypoint: string; + /** + * The code size in bytes. + */ + sourceSize: number; + /** + * The build output size in bytes. + */ + buildSize: number; + /** + * The total size in bytes (source and build output). + */ + totalSize: number; + /** + * The current build ID. + */ + buildId: string; + /** + * Whether the deployment should be automatically activated. + */ + activate: boolean; + /** + * Screenshot with light theme preference file ID. + */ + screenshotLight: string; + /** + * Screenshot with dark theme preference file ID. + */ + screenshotDark: string; + /** + * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + */ + status: DeploymentStatus; + /** + * The build logs. + */ + buildLogs: string; + /** + * The current build time in seconds. + */ + buildDuration: number; + /** + * The name of the vcs provider repository + */ + providerRepositoryName: string; + /** + * The name of the vcs provider repository owner + */ + providerRepositoryOwner: string; + /** + * The url of the vcs provider repository + */ + providerRepositoryUrl: string; + /** + * The commit hash of the vcs commit + */ + providerCommitHash: string; + /** + * The url of vcs commit author + */ + providerCommitAuthorUrl: string; + /** + * The name of vcs commit author + */ + providerCommitAuthor: string; + /** + * The commit message + */ + providerCommitMessage: string; + /** + * The url of the vcs commit + */ + providerCommitUrl: string; + /** + * The branch of the vcs repository + */ + providerBranch: string; + /** + * The branch of the vcs repository + */ + providerBranchUrl: string; + } + + /** + * Execution + */ + export type Execution = { + /** + * Execution ID. + */ + $id: string; + /** + * Execution creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Execution update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Execution roles. + */ + $permissions: string[]; + /** + * Function ID. + */ + functionId: string; + /** + * Function's deployment ID used to create the execution. + */ + deploymentId: string; + /** + * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + */ + trigger: ExecutionTrigger; + /** + * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + */ + status: ExecutionStatus; + /** + * HTTP request method type. + */ + requestMethod: string; + /** + * HTTP request path and query. + */ + requestPath: string; + /** + * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + */ + requestHeaders: Headers[]; + /** + * HTTP response status code. + */ + responseStatusCode: number; + /** + * HTTP response body. This will return empty unless execution is created as synchronous. + */ + responseBody: string; + /** + * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + */ + responseHeaders: Headers[]; + /** + * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + logs: string; + /** + * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + errors: string; + /** + * Resource(function/site) execution duration in seconds. + */ + duration: number; + /** + * The scheduled time for execution. If left empty, execution will be queued immediately. + */ + scheduledAt?: string; + } + + /** + * Project + */ + export type Project = { + /** + * Project ID. + */ + $id: string; + /** + * Project creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Project update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * 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. + */ + devKeys: DevKey[]; + /** + * Status for custom SMTP + */ + smtpEnabled: boolean; + /** + * SMTP sender name + */ + smtpSenderName: string; + /** + * SMTP sender email + */ + smtpSenderEmail: string; + /** + * SMTP reply to name + */ + smtpReplyToName: string; + /** + * SMTP reply to email + */ + smtpReplyToEmail: string; + /** + * SMTP server host name + */ + smtpHost: string; + /** + * SMTP server port + */ + smtpPort: number; + /** + * SMTP server username + */ + smtpUsername: string; + /** + * SMTP server password. This property is write-only and always returned empty. + */ + smtpPassword: string; + /** + * SMTP server secure protocol + */ + smtpSecure: string; + /** + * Number of times the ping was received for this project. + */ + pingCount: number; + /** + * Last ping datetime in ISO 8601 format. + */ + pingedAt: string; + /** + * Labels for the project. + */ + labels: string[]; + /** + * Project status + */ + 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 + */ + authPhone: boolean; + /** + * Account service status + */ + serviceStatusForAccount: boolean; + /** + * Avatars service status + */ + serviceStatusForAvatars: boolean; + /** + * 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 + */ + serviceStatusForGraphql: boolean; + /** + * Migrations service status + */ + serviceStatusForMigrations: boolean; + /** + * Messaging service status + */ + serviceStatusForMessaging: boolean; + /** + * REST protocol status + */ + protocolStatusForRest: boolean; + /** + * GraphQL protocol status + */ + protocolStatusForGraphql: boolean; + /** + * Websocket protocol status + */ + protocolStatusForWebsocket: boolean; + /** + * Project region + */ + region: string; + /** + * Billing limits reached + */ + billingLimits: BillingLimits; + /** + * Project blocks information + */ + blocks: Block[]; + /** + * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + */ + consoleAccessedAt: string; + } + + /** + * Webhook + */ + export type Webhook = { + /** + * Webhook ID. + */ + $id: string; + /** + * Webhook creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Webhook update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Webhook name. + */ + name: string; + /** + * Webhook URL endpoint. + */ + url: string; + /** + * Webhook trigger events. + */ + events: string[]; + /** + * Indicates if SSL / TLS certificate verification is enabled. + */ + tls: boolean; + /** + * HTTP basic authentication username. + */ + authUsername: string; + /** + * HTTP basic authentication password. + */ + authPassword: string; + /** + * Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. + */ + secret: string; + /** + * Indicates if this webhook is enabled. + */ + enabled: boolean; + /** + * Webhook error logs from the most recent failure. + */ + logs: string; + /** + * Number of consecutive failed webhook attempts. + */ + attempts: number; + } + + /** + * Key + */ + export type Key = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * Ephemeral Key + */ + export type EphemeralKey = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * DevKey + */ + export type DevKey = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * Mock Number + */ + export type MockNumber = { + /** + * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. + */ + number: string; + /** + * Mock OTP for the number. + */ + otp: string; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + } + + /** + * OAuth2GitHub + */ + export type OAuth2Github = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. + */ + clientId: string; + /** + * GitHub OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Discord + */ + export type OAuth2Discord = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Discord OAuth2 client ID. + */ + clientId: string; + /** + * Discord OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Figma + */ + export type OAuth2Figma = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Figma OAuth2 client ID. + */ + clientId: string; + /** + * Figma OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Dropbox + */ + export type OAuth2Dropbox = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Dropbox OAuth2 app key. + */ + appKey: string; + /** + * Dropbox OAuth2 app secret. + */ + appSecret: string; + } + + /** + * OAuth2Dailymotion + */ + export type OAuth2Dailymotion = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Dailymotion OAuth2 API key. + */ + apiKey: string; + /** + * Dailymotion OAuth2 API secret. + */ + apiSecret: string; + } + + /** + * OAuth2Bitbucket + */ + export type OAuth2Bitbucket = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Bitbucket OAuth2 key. + */ + key: string; + /** + * Bitbucket OAuth2 secret. + */ + secret: string; + } + + /** + * OAuth2Bitly + */ + export type OAuth2Bitly = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Bitly OAuth2 client ID. + */ + clientId: string; + /** + * Bitly OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Box + */ + export type OAuth2Box = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Box OAuth2 client ID. + */ + clientId: string; + /** + * Box OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Autodesk + */ + export type OAuth2Autodesk = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Autodesk OAuth2 client ID. + */ + clientId: string; + /** + * Autodesk OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Google + */ + export type OAuth2Google = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Google OAuth2 client ID. + */ + clientId: string; + /** + * Google OAuth2 client secret. + */ + clientSecret: string; + /** + * Google OAuth2 prompt values. + */ + prompt: OAuth2GooglePrompt[]; + } + + /** + * OAuth2Zoom + */ + export type OAuth2Zoom = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Zoom OAuth2 client ID. + */ + clientId: string; + /** + * Zoom OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Zoho + */ + export type OAuth2Zoho = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Zoho OAuth2 client ID. + */ + clientId: string; + /** + * Zoho OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Yandex + */ + export type OAuth2Yandex = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yandex OAuth2 client ID. + */ + clientId: string; + /** + * Yandex OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2X + */ + export type OAuth2X = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * X OAuth2 customer key. + */ + customerKey: string; + /** + * X OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2WordPress + */ + export type OAuth2WordPress = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * WordPress OAuth2 client ID. + */ + clientId: string; + /** + * WordPress OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Twitch + */ + export type OAuth2Twitch = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Twitch OAuth2 client ID. + */ + clientId: string; + /** + * Twitch OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Stripe + */ + export type OAuth2Stripe = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Stripe OAuth2 client ID. + */ + clientId: string; + /** + * Stripe OAuth2 API secret key. + */ + apiSecretKey: string; + } + + /** + * OAuth2Spotify + */ + export type OAuth2Spotify = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Spotify OAuth2 client ID. + */ + clientId: string; + /** + * Spotify OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Slack + */ + export type OAuth2Slack = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Slack OAuth2 client ID. + */ + clientId: string; + /** + * Slack OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Podio + */ + export type OAuth2Podio = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Podio OAuth2 client ID. + */ + clientId: string; + /** + * Podio OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Notion + */ + export type OAuth2Notion = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Notion OAuth2 client ID. + */ + oauthClientId: string; + /** + * Notion OAuth2 client secret. + */ + oauthClientSecret: string; + } + + /** + * OAuth2Salesforce + */ + export type OAuth2Salesforce = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Salesforce OAuth2 consumer key. + */ + customerKey: string; + /** + * Salesforce OAuth2 consumer secret. + */ + customerSecret: string; + } + + /** + * OAuth2Yahoo + */ + export type OAuth2Yahoo = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yahoo OAuth2 client ID. + */ + clientId: string; + /** + * Yahoo OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Linkedin + */ + export type OAuth2Linkedin = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * LinkedIn OAuth2 client ID. + */ + clientId: string; + /** + * LinkedIn OAuth2 primary client secret. + */ + primaryClientSecret: string; + } + + /** + * OAuth2Disqus + */ + export type OAuth2Disqus = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Disqus OAuth2 public key. + */ + publicKey: string; + /** + * Disqus OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Amazon + */ + export type OAuth2Amazon = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Amazon OAuth2 client ID. + */ + clientId: string; + /** + * Amazon OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Etsy + */ + export type OAuth2Etsy = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Etsy OAuth2 keystring. + */ + keyString: string; + /** + * Etsy OAuth2 shared secret. + */ + sharedSecret: string; + } + + /** + * OAuth2Facebook + */ + export type OAuth2Facebook = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Facebook OAuth2 app ID. + */ + appId: string; + /** + * Facebook OAuth2 app secret. + */ + appSecret: string; + } + + /** + * OAuth2Tradeshift + */ + export type OAuth2Tradeshift = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Tradeshift OAuth2 client ID. + */ + oauth2ClientId: string; + /** + * Tradeshift OAuth2 client secret. + */ + oauth2ClientSecret: string; + } + + /** + * OAuth2Paypal + */ + export type OAuth2Paypal = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * PayPal OAuth2 client ID. + */ + clientId: string; + /** + * PayPal OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Gitlab + */ + export type OAuth2Gitlab = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * GitLab OAuth2 application ID. + */ + applicationId: string; + /** + * GitLab OAuth2 secret. + */ + secret: string; + /** + * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + */ + endpoint: string; + } + + /** + * OAuth2Authentik + */ + export type OAuth2Authentik = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Authentik OAuth2 client ID. + */ + clientId: string; + /** + * Authentik OAuth2 client secret. + */ + clientSecret: string; + /** + * Authentik OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Auth0 + */ + export type OAuth2Auth0 = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Auth0 OAuth2 client ID. + */ + clientId: string; + /** + * Auth0 OAuth2 client secret. + */ + clientSecret: string; + /** + * Auth0 OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2FusionAuth + */ + export type OAuth2FusionAuth = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * FusionAuth OAuth2 client ID. + */ + clientId: string; + /** + * FusionAuth OAuth2 client secret. + */ + clientSecret: string; + /** + * FusionAuth OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Keycloak + */ + export type OAuth2Keycloak = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Keycloak OAuth2 client ID. + */ + clientId: string; + /** + * Keycloak OAuth2 client secret. + */ + clientSecret: string; + /** + * Keycloak OAuth2 endpoint domain. + */ + endpoint: string; + /** + * Keycloak OAuth2 realm name. + */ + realmName: string; + } + + /** + * OAuth2Oidc + */ + export type OAuth2Oidc = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * OpenID Connect OAuth2 client ID. + */ + clientId: string; + /** + * OpenID Connect OAuth2 client secret. + */ + clientSecret: string; + /** + * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + */ + wellKnownURL: string; + /** + * OpenID Connect authorization endpoint URL. + */ + authorizationURL: string; + /** + * OpenID Connect token endpoint URL. + */ + tokenURL: string; + /** + * OpenID Connect user info endpoint URL. + */ + userInfoURL: string; + } + + /** + * OAuth2Okta + */ + export type OAuth2Okta = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Okta OAuth2 client ID. + */ + clientId: string; + /** + * Okta OAuth2 client secret. + */ + clientSecret: string; + /** + * Okta OAuth2 domain. + */ + domain: string; + /** + * Okta OAuth2 authorization server ID. + */ + authorizationServerId: string; + } + + /** + * OAuth2Kick + */ + export type OAuth2Kick = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Kick OAuth2 client ID. + */ + clientId: string; + /** + * Kick OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Apple + */ + export type OAuth2Apple = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Apple OAuth2 service ID. + */ + serviceId: string; + /** + * Apple OAuth2 key ID. + */ + keyId: string; + /** + * Apple OAuth2 team ID. + */ + teamId: string; + /** + * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + */ + p8File: string; + } + + /** + * OAuth2Microsoft + */ + export type OAuth2Microsoft = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Microsoft OAuth2 application ID. + */ + applicationId: string; + /** + * Microsoft OAuth2 application secret. + */ + applicationSecret: string; + /** + * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + */ + tenant: string; + } + + /** + * OAuth2 Providers List + */ + export type OAuth2ProviderList = { + /** + * Total number of OAuth2 providers in the given project. + */ + total: number; + /** + * List of OAuth2 providers. + */ + providers: (Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; + } + + /** + * Policy Password Dictionary + */ + export type PolicyPasswordDictionary = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password dictionary policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Password History + */ + export type PolicyPasswordHistory = { + /** + * Policy ID. + */ + $id: string; + /** + * Password history length. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Password Personal Data + */ + export type PolicyPasswordPersonalData = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password personal data policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Alert + */ + export type PolicySessionAlert = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session alert policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Duration + */ + export type PolicySessionDuration = { + /** + * Policy ID. + */ + $id: string; + /** + * Session duration in seconds. + */ + duration: number; + } + + /** + * Policy Session Invalidation + */ + export type PolicySessionInvalidation = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session invalidation policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Limit + */ + export type PolicySessionLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy User Limit + */ + export type PolicyUserLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Membership Privacy + */ + export type PolicyMembershipPrivacy = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether user ID is visible in memberships. + */ + userId: boolean; + /** + * Whether user email is visible in memberships. + */ + userEmail: boolean; + /** + * Whether user phone is visible in memberships. + */ + userPhone: boolean; + /** + * Whether user name is visible in memberships. + */ + userName: boolean; + /** + * Whether user MFA status is visible in memberships. + */ + userMFA: boolean; + } + + /** + * AuthProvider + */ + export type AuthProvider = { + /** + * Auth Provider. + */ + key: string; + /** + * Auth Provider name. + */ + name: string; + /** + * OAuth 2.0 application ID. + */ + appId: string; + /** + * OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. + */ + secret: string; + /** + * Auth Provider is active and can be used to create session. + */ + enabled: boolean; + } + + /** + * Platform Web + */ + export type PlatformWeb = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Web app hostname. Empty string for other platforms. + */ + hostname: string; + } + + /** + * Platform Apple + */ + export type PlatformApple = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Apple bundle identifier. + */ + bundleIdentifier: string; + } + + /** + * Platform Android + */ + export type PlatformAndroid = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Android application ID. + */ + applicationId: string; + } + + /** + * Platform Windows + */ + export type PlatformWindows = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Windows package identifier name. + */ + packageIdentifierName: string; + } + + /** + * Platform Linux + */ + export type PlatformLinux = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Linux package name. + */ + packageName: string; + } + + /** + * Platforms List + */ + export type PlatformList = { + /** + * Total number of platforms in the given project. + */ + total: number; + /** + * List of platforms. + */ + platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; + } + + /** + * Variable + */ + export type Variable = { + /** + * Variable ID. + */ + $id: string; + /** + * Variable creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Variable creation date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Variable key. + */ + key: string; + /** + * Variable value. + */ + value: string; + /** + * Variable secret flag. Secret variables can only be updated or deleted, but never read. + */ + secret: boolean; + /** + * Service to which the variable belongs. Possible values are "project", "function" + */ + resourceType: string; + /** + * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + */ + resourceId: string; + } + + /** + * Country + */ + export type Country = { + /** + * Country name. + */ + name: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + code: string; + } + + /** + * Continent + */ + export type Continent = { + /** + * Continent name. + */ + name: string; + /** + * Continent two letter code. + */ + code: string; + } + + /** + * Language + */ + export type Language = { + /** + * Language name. + */ + name: string; + /** + * Language two-character ISO 639-1 codes. + */ + code: string; + /** + * Language native name. + */ + nativeName: string; + } + + /** + * Currency + */ + export type Currency = { + /** + * Currency symbol. + */ + symbol: string; + /** + * Currency name. + */ + name: string; + /** + * Currency native symbol. + */ + symbolNative: string; + /** + * Number of decimal digits. + */ + decimalDigits: number; + /** + * Currency digit rounding. + */ + rounding: number; + /** + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + */ + code: string; + /** + * Currency plural name + */ + namePlural: string; + } + + /** + * Phone + */ + export type Phone = { + /** + * Phone code. + */ + code: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * Health Antivirus + */ + export type HealthAntivirus = { + /** + * Antivirus version. + */ + version: string; + /** + * Antivirus status. Possible values are: `disabled`, `offline`, `online` + */ + status: HealthAntivirusStatus; + } + + /** + * Health Queue + */ + export type HealthQueue = { + /** + * Amount of actions in the queue. + */ + size: number; + } + + /** + * Health Status + */ + export type HealthStatus = { + /** + * Name of the service. + */ + name: string; + /** + * Duration in milliseconds how long the health check took. + */ + ping: number; + /** + * Service status. Possible values are: `pass`, `fail` + */ + status: HealthCheckStatus; + } + + /** + * Health Certificate + */ + export type HealthCertificate = { + /** + * Certificate name + */ + name: string; + /** + * Subject SN + */ + subjectSN: string; + /** + * Issuer organisation + */ + issuerOrganisation: string; + /** + * Valid from + */ + validFrom: string; + /** + * Valid to + */ + validTo: string; + /** + * Signature type SN + */ + signatureTypeSN: string; + } + + /** + * Health Time + */ + export type HealthTime = { + /** + * Current unix timestamp on trustful remote server. + */ + remoteTime: number; + /** + * Current unix timestamp of local server where Appwrite runs. + */ + localTime: number; + /** + * Difference of unix remote and local timestamps in milliseconds. + */ + diff: number; + } + + /** + * Headers + */ + export type Headers = { + /** + * Header name. + */ + name: string; + /** + * Header value. + */ + value: string; + } + + /** + * Specification + */ + export type Specification = { + /** + * Memory size in MB. + */ + memory: number; + /** + * Number of CPUs. + */ + cpus: number; + /** + * Is size enabled. + */ + enabled: boolean; + /** + * Size slug. + */ + slug: string; + } + + /** + * Rule + */ + export type ProxyRule = { + /** + * Rule ID. + */ + $id: string; + /** + * Rule creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Rule update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Domain name. + */ + domain: string; + /** + * Action definition for the rule. Possible values are "api", "deployment", or "redirect" + */ + type: string; + /** + * Defines how the rule was created. Possible values are "manual" or "deployment" + */ + trigger: string; + /** + * URL to redirect to. Used if type is "redirect" + */ + redirectUrl: string; + /** + * Status code to apply during redirect. Used if type is "redirect" + */ + redirectStatusCode: number; + /** + * ID of deployment. Used if type is "deployment" + */ + deploymentId: string; + /** + * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + */ + deploymentResourceType?: ProxyRuleDeploymentResourceType; + /** + * ID of deployment's resource (site or function ID). Used if type is "deployment" + */ + deploymentResourceId: string; + /** + * Name of Git branch that updates rule. Used if type is "deployment" + */ + deploymentVcsProviderBranch: string; + /** + * Domain verification status. Possible values are "unverified", "verifying", "verified" + */ + status: ProxyRuleStatus; + /** + * Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + */ + logs: string; + /** + * Certificate auto-renewal date in ISO 8601 format. + */ + renewAt: string; + } + + /** + * EmailTemplate + */ + export type EmailTemplate = { + /** + * Template type + */ + templateId: string; + /** + * Template locale + */ + locale: string; + /** + * Template message + */ + message: string; + /** + * Name of the sender + */ + senderName: string; + /** + * Email of the sender + */ + senderEmail: string; + /** + * Reply to email address + */ + replyToEmail: string; + /** + * Reply to name + */ + replyToName: string; + /** + * Email subject + */ + subject: string; + } + + /** + * MFA Challenge + */ + export type MfaChallenge = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User ID. + */ + userId: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + } + + /** + * MFA Recovery Codes + */ + export type MfaRecoveryCodes = { + /** + * Recovery codes. + */ + recoveryCodes: string[]; + } + + /** + * MFAType + */ + export type MfaType = { + /** + * Secret token used for TOTP factor. + */ + secret: string; + /** + * URI for authenticator apps. + */ + uri: string; + } + + /** + * MFAFactors + */ + export type MfaFactors = { + /** + * Can TOTP be used for MFA challenge for this account. + */ + totp: boolean; + /** + * Can phone (SMS) be used for MFA challenge for this account. + */ + phone: boolean; + /** + * Can email be used for MFA challenge for this account. + */ + email: boolean; + /** + * Can recovery code be used for MFA challenge for this account. + */ + recoveryCode: boolean; + } + + /** + * Provider + */ + export type Provider = { + /** + * Provider ID. + */ + $id: string; + /** + * Provider creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Provider update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The name for the provider instance. + */ + name: string; + /** + * The name of the provider service. + */ + provider: string; + /** + * Is provider enabled? + */ + enabled: boolean; + /** + * Type of provider. + */ + type: string; + /** + * Provider credentials. + */ + credentials: object; + /** + * Provider options. + */ + options?: object; + } + + /** + * Message + */ + export type Message = { + /** + * Message ID. + */ + $id: string; + /** + * Message creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Message update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Message provider type. + */ + providerType: string; + /** + * Topic IDs set as recipients. + */ + topics: string[]; + /** + * User IDs set as recipients. + */ + users: string[]; + /** + * Target IDs set as recipients. + */ + targets: string[]; + /** + * The scheduled time for message. + */ + scheduledAt?: string; + /** + * The time when the message was delivered. + */ + deliveredAt?: string; + /** + * Delivery errors if any. + */ + deliveryErrors?: string[]; + /** + * Number of recipients the message was delivered to. + */ + deliveredTotal: number; + /** + * Data of the message. + */ + data: object; + /** + * Status of delivery. + */ + status: MessageStatus; + } + + /** + * Topic + */ + export type Topic = { + /** + * Topic ID. + */ + $id: string; + /** + * Topic creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Topic update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The name of the topic. + */ + name: string; + /** + * Total count of email subscribers subscribed to the topic. + */ + emailTotal: number; + /** + * Total count of SMS subscribers subscribed to the topic. + */ + smsTotal: number; + /** + * Total count of push subscribers subscribed to the topic. + */ + pushTotal: number; + /** + * Subscribe permissions. + */ + subscribe: string[]; + } + + /** + * Transaction + */ + export type Transaction = { + /** + * Transaction ID. + */ + $id: string; + /** + * Transaction creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Transaction update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + */ + status: string; + /** + * Number of operations in the transaction. + */ + operations: number; + /** + * Expiration time in ISO 8601 format. + */ + expiresAt: string; + } + + /** + * Subscriber + */ + export type Subscriber = { + /** + * Subscriber ID. + */ + $id: string; + /** + * Subscriber creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Subscriber update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Target ID. + */ + targetId: string; + /** + * Target. + */ + target: Target; + /** + * Topic ID. + */ + userId: string; + /** + * User Name. + */ + userName: string; + /** + * Topic ID. + */ + topicId: string; + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + providerType: string; + } + + /** + * Target + */ + export type Target = { + /** + * Target ID. + */ + $id: string; + /** + * Target creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Target update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Target Name. + */ + name: string; + /** + * User ID. + */ + userId: string; + /** + * Provider ID. + */ + providerId?: string; + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + providerType: string; + /** + * The target identifier. + */ + identifier: string; + /** + * Is the target expired. + */ + expired: boolean; + } + + /** + * ActivityEvent + */ + export type ActivityEvent = { + /** + * Event ID. + */ + $id: string; + /** + * User type. + */ + userType: string; + /** + * User ID. + */ + userId: string; + /** + * User Email. + */ + userEmail: string; + /** + * User Name. + */ + userName: string; + /** + * Resource parent. + */ + resourceParent: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource. + */ + resource: string; + /** + * Event name. + */ + event: string; + /** + * User agent. + */ + userAgent: string; + /** + * IP address. + */ + ip: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * Location. + */ + country: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Project ID. + */ + projectId: string; + /** + * Team ID. + */ + teamId: string; + /** + * Hostname. + */ + hostname: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * Archive + */ + export type BackupArchive = { + /** + * Archive ID. + */ + $id: string; + /** + * Archive creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Archive update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Archive policy ID. + */ + policyId: string; + /** + * Archive size in bytes. + */ + size: number; + /** + * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this archive. + */ + services: string[]; + /** + * The resources that are backed up by this archive. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this archive should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this archive should backup a single resource. + */ + resourceType?: string; + } + + /** + * BillingLimits + */ + export type BillingLimits = { + /** + * Bandwidth limit + */ + bandwidth: number; + /** + * Storage limit + */ + storage: number; + /** + * Users limit + */ + users: number; + /** + * Executions limit + */ + executions: number; + /** + * GBHours limit + */ + GBHours: number; + /** + * Image transformations limit + */ + imageTransformations: number; + /** + * Auth phone limit + */ + authPhone: number; + /** + * Budget limit percentage + */ + budgetLimit: number; + } + + /** + * Block + */ + export type Block = { + /** + * Block creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Resource type that is blocked + */ + resourceType: string; + /** + * Resource identifier that is blocked + */ + resourceId: string; + /** + * Reason for the block. Can be null if no reason was provided. + */ + reason?: string; + /** + * Block expiration date in ISO 8601 format. Can be null if the block does not expire. + */ + expiredAt?: string; + /** + * Name of the project this block applies to. + */ + projectName: string; + /** + * Region of the project this block applies to. + */ + region: string; + /** + * Name of the organization that owns the project. + */ + organizationName: string; + /** + * ID of the organization that owns the project. + */ + organizationId: string; + /** + * Billing plan of the organization that owns the project. + */ + billingPlan: string; + } + + /** + * backup + */ + export type BackupPolicy = { + /** + * Backup policy ID. + */ + $id: string; + /** + * Backup policy name. + */ + name: string; + /** + * Policy creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Policy update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this policy should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this policy should backup a single resource. + */ + resourceType?: string; + /** + * How many days to keep the backup before it will be automatically deleted. + */ + retention: number; + /** + * Policy backup schedule in CRON format. + */ + schedule: string; + /** + * Is this policy enabled. + */ + enabled: boolean; + } + + /** + * Restoration + */ + export type BackupRestoration = { + /** + * Restoration ID. + */ + $id: string; + /** + * Restoration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Restoration update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Backup archive ID. + */ + archiveId: string; + /** + * Backup policy ID. + */ + policyId: string; + /** + * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * Optional data in key-value object. + */ + options: string; + } + + /** + * Activity event list + */ + export type ActivityEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: ActivityEvent[]; + } + + /** + * Backup archive list + */ + export type BackupArchiveList = { + /** + * Total number of archives that matched your query. + */ + total: number; + /** + * List of archives. + */ + archives: BackupArchive[]; + } + + /** + * Backup policy list + */ + export type BackupPolicyList = { + /** + * Total number of policies that matched your query. + */ + total: number; + /** + * List of policies. + */ + policies: BackupPolicy[]; + } + + /** + * Backup restoration list + */ + export type BackupRestorationList = { + /** + * Total number of restorations that matched your query. + */ + total: number; + /** + * List of restorations. + */ + restorations: BackupRestoration[]; } } diff --git a/src/services/account.ts b/src/services/account.ts index 5a3f7926..15e0971f 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1855,95 +1855,6 @@ export class Account { ); } - /** - * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. - * - * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. - * - * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - * - * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {void | string} - */ - createOAuth2Session(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string; - /** - * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. - * - * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. - * - * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - * - * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. - * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {void | string} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string; - createOAuth2Session( - paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider, - ...rest: [(string)?, (string)?, (string[])?] - ): void | string { - let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; - } else { - params = { - provider: paramsOrFirst as OAuthProvider, - success: rest[0] as string, - failure: rest[1] as string, - scopes: rest[2] as string[] - }; - } - - const provider = params.provider; - const success = params.success; - const failure = params.failure; - const scopes = params.scopes; - - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - - const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider); - const payload: Payload = {}; - if (typeof success !== 'undefined') { - payload['success'] = success; - } - if (typeof failure !== 'undefined') { - payload['failure'] = failure; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - payload['project'] = this.client.config.project; - - for (const [key, value] of Object.entries(Service.flatten(payload))) { - uri.searchParams.append(key, value); - } - - if (typeof window !== 'undefined' && window?.location) { - window.location.href = uri.toString(); - return; - } else { - return uri.toString(); - } - } - /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -2256,194 +2167,6 @@ export class Account { ); } - /** - * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model. - * - * @param {string} params.targetId - Target 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.identifier - The target identifier (token, email, phone etc.) - * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - createPushTarget(params: { targetId: string, identifier: string, providerId?: string }): Promise<Models.Target>; - /** - * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model. - * - * @param {string} targetId - Target 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} identifier - The target identifier (token, email, phone etc.) - * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>; - createPushTarget( - paramsOrFirst: { targetId: string, identifier: string, providerId?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Target> { - let params: { targetId: string, identifier: string, providerId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { targetId: string, identifier: string, providerId?: string }; - } else { - params = { - targetId: paramsOrFirst as string, - identifier: rest[0] as string, - providerId: rest[1] as string - }; - } - - const targetId = params.targetId; - const identifier = params.identifier; - const providerId = params.providerId; - - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (typeof identifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "identifier"'); - } - - const apiPath = '/account/targets/push'; - const payload: Payload = {}; - if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; - } - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead. - * - * @param {string} params.targetId - Target ID. - * @param {string} params.identifier - The target identifier (token, email, phone etc.) - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - updatePushTarget(params: { targetId: string, identifier: string }): Promise<Models.Target>; - /** - * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead. - * - * @param {string} targetId - Target ID. - * @param {string} identifier - The target identifier (token, email, phone etc.) - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>; - updatePushTarget( - paramsOrFirst: { targetId: string, identifier: string } | string, - ...rest: [(string)?] - ): Promise<Models.Target> { - let params: { targetId: string, identifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { targetId: string, identifier: string }; - } else { - params = { - targetId: paramsOrFirst as string, - identifier: rest[0] as string - }; - } - - const targetId = params.targetId; - const identifier = params.identifier; - - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (typeof identifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "identifier"'); - } - - const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId); - const payload: Payload = {}; - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user. - * - * @param {string} params.targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePushTarget(params: { targetId: string }): Promise<{}>; - /** - * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user. - * - * @param {string} targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePushTarget(targetId: string): Promise<{}>; - deletePushTarget( - paramsOrFirst: { targetId: string } | string - ): Promise<{}> { - let params: { targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { targetId: string }; - } else { - params = { - targetId: paramsOrFirst as string - }; - } - - const targetId = params.targetId; - - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId); - 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 - ); - } - /** * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. * @@ -2683,6 +2406,7 @@ export class Account { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/activities.ts b/src/services/activities.ts new file mode 100644 index 00000000..bf9a2b45 --- /dev/null +++ b/src/services/activities.ts @@ -0,0 +1,116 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Activities { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all events for selected filters. + * + * @param {string} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEventList>} + */ + listEvents(params?: { queries?: string }): Promise<Models.ActivityEventList>; + /** + * List all events for selected filters. + * + * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEventList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEvents(queries?: string): Promise<Models.ActivityEventList>; + listEvents( + paramsOrFirst?: { queries?: string } | string + ): Promise<Models.ActivityEventList> { + let params: { queries?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string }; + } else { + params = { + queries: paramsOrFirst as string + }; + } + + const queries = params.queries; + + + const apiPath = '/activities/events'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get event by ID. + * + * + * @param {string} params.eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEvent>} + */ + getEvent(params: { eventId: string }): Promise<Models.ActivityEvent>; + /** + * Get event by ID. + * + * + * @param {string} eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEvent>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEvent(eventId: string): Promise<Models.ActivityEvent>; + getEvent( + paramsOrFirst: { eventId: string } | string + ): Promise<Models.ActivityEvent> { + let params: { eventId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { eventId: string }; + } else { + params = { + eventId: paramsOrFirst as string + }; + } + + const eventId = params.eventId; + + if (typeof eventId === 'undefined') { + throw new AppwriteException('Missing required parameter: "eventId"'); + } + + const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/avatars.ts b/src/services/avatars.ts index eea5a0f8..66c40fe1 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -87,6 +87,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -167,6 +168,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -226,6 +228,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -306,6 +309,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -384,6 +388,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -468,6 +473,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -547,6 +553,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -744,6 +751,7 @@ export class Avatars { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/backups.ts b/src/services/backups.ts new file mode 100644 index 00000000..99b1fabd --- /dev/null +++ b/src/services/backups.ts @@ -0,0 +1,754 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { BackupServices } from '../enums/backup-services'; + +export class Backups { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all archives for a project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchiveList>} + */ + listArchives(params?: { queries?: string[] }): Promise<Models.BackupArchiveList>; + /** + * List all archives for a project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchiveList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listArchives(queries?: string[]): Promise<Models.BackupArchiveList>; + listArchives( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupArchiveList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/archives'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new archive asynchronously for a project. + * + * @param {BackupServices[]} params.services - Array of services to backup + * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + */ + createArchive(params: { services: BackupServices[], resourceId?: string }): Promise<Models.BackupArchive>; + /** + * Create a new archive asynchronously for a project. + * + * @param {BackupServices[]} services - Array of services to backup + * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createArchive(services: BackupServices[], resourceId?: string): Promise<Models.BackupArchive>; + createArchive( + paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], + ...rest: [(string)?] + ): Promise<Models.BackupArchive> { + let params: { services: BackupServices[], resourceId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { services: BackupServices[], resourceId?: string }; + } else { + params = { + services: paramsOrFirst as BackupServices[], + resourceId: rest[0] as string + }; + } + + const services = params.services; + const resourceId = params.resourceId; + + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + + const apiPath = '/backups/archives'; + const payload: Payload = {}; + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a backup archive using it's ID. + * + * @param {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + */ + getArchive(params: { archiveId: string }): Promise<Models.BackupArchive>; + /** + * Get a backup archive using it's ID. + * + * @param {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getArchive(archiveId: string): Promise<Models.BackupArchive>; + getArchive( + paramsOrFirst: { archiveId: string } | string + ): Promise<Models.BackupArchive> { + let params: { archiveId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string }; + } else { + params = { + archiveId: paramsOrFirst as string + }; + } + + const archiveId = params.archiveId; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an existing archive for a project. + * + * @param {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteArchive(params: { archiveId: string }): Promise<{}>; + /** + * Delete an existing archive for a project. + * + * @param {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteArchive(archiveId: string): Promise<{}>; + deleteArchive( + paramsOrFirst: { archiveId: string } | string + ): Promise<{}> { + let params: { archiveId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string }; + } else { + params = { + archiveId: paramsOrFirst as string + }; + } + + const archiveId = params.archiveId; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List all policies for a project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicyList>} + */ + listPolicies(params?: { queries?: string[] }): Promise<Models.BackupPolicyList>; + /** + * List all policies for a project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPolicies(queries?: string[]): Promise<Models.BackupPolicyList>; + listPolicies( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupPolicyList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new backup policy. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {BackupServices[]} params.services - Array of services to backup + * @param {number} params.retention - Days to keep backups before deletion + * @param {string} params.schedule - Schedule CRON syntax. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. + * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; + /** + * Create a new backup policy. + * + * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {BackupServices[]} services - Array of services to backup + * @param {number} retention - Days to keep backups before deletion + * @param {string} schedule - Schedule CRON syntax. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. + * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>; + createPolicy( + paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, + ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.BackupPolicy> { + let params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; + } else { + params = { + policyId: paramsOrFirst as string, + services: rest[0] as BackupServices[], + retention: rest[1] as number, + schedule: rest[2] as string, + name: rest[3] as string, + resourceId: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const policyId = params.policyId; + const services = params.services; + const retention = params.retention; + const schedule = params.schedule; + const name = params.name; + const resourceId = params.resourceId; + const enabled = params.enabled; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + if (typeof retention === 'undefined') { + throw new AppwriteException('Missing required parameter: "retention"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException('Missing required parameter: "schedule"'); + } + + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof policyId !== 'undefined') { + payload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a backup policy using it's ID. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + getPolicy(params: { policyId: string }): Promise<Models.BackupPolicy>; + /** + * Get a backup policy using it's ID. + * + * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPolicy(policyId: string): Promise<Models.BackupPolicy>; + getPolicy( + paramsOrFirst: { policyId: string } | string + ): Promise<Models.BackupPolicy> { + let params: { policyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string }; + } else { + params = { + policyId: paramsOrFirst as string + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an existing policy using it's ID. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {number} params.retention - Days to keep backups before deletion + * @param {string} params.schedule - Cron expression + * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; + /** + * Update an existing policy using it's ID. + * + * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {number} retention - Days to keep backups before deletion + * @param {string} schedule - Cron expression + * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy>; + updatePolicy( + paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, + ...rest: [(string)?, (number)?, (string)?, (boolean)?] + ): Promise<Models.BackupPolicy> { + let params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; + } else { + params = { + policyId: paramsOrFirst as string, + name: rest[0] as string, + retention: rest[1] as number, + schedule: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const policyId = params.policyId; + const name = params.name; + const retention = params.retention; + const schedule = params.schedule; + const enabled = params.enabled; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a policy using it's ID. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePolicy(params: { policyId: string }): Promise<{}>; + /** + * Delete a policy using it's ID. + * + * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePolicy(policyId: string): Promise<{}>; + deletePolicy( + paramsOrFirst: { policyId: string } | string + ): Promise<{}> { + let params: { policyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string }; + } else { + params = { + policyId: paramsOrFirst as string + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param {string} params.archiveId - Backup archive ID to restore + * @param {BackupServices[]} params.services - Array of services to restore + * @param {string} params.newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.newResourceName - Database name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + */ + createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise<Models.BackupRestoration>; + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param {string} archiveId - Backup archive ID to restore + * @param {BackupServices[]} services - Array of services to restore + * @param {string} newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} newResourceName - Database name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration>; + createRestoration( + paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, + ...rest: [(BackupServices[])?, (string)?, (string)?] + ): Promise<Models.BackupRestoration> { + let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + } else { + params = { + archiveId: paramsOrFirst as string, + services: rest[0] as BackupServices[], + newResourceId: rest[1] as string, + newResourceName: rest[2] as string + }; + } + + const archiveId = params.archiveId; + const services = params.services; + const newResourceId = params.newResourceId; + const newResourceName = params.newResourceName; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + + const apiPath = '/backups/restoration'; + const payload: Payload = {}; + if (typeof archiveId !== 'undefined') { + payload['archiveId'] = archiveId; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof newResourceId !== 'undefined') { + payload['newResourceId'] = newResourceId; + } + if (typeof newResourceName !== 'undefined') { + payload['newResourceName'] = newResourceName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * List all backup restorations for a project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestorationList>} + */ + listRestorations(params?: { queries?: string[] }): Promise<Models.BackupRestorationList>; + /** + * List all backup restorations for a project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestorationList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRestorations(queries?: string[]): Promise<Models.BackupRestorationList>; + listRestorations( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupRestorationList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/restorations'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the current status of a backup restoration. + * + * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + */ + getRestoration(params: { restorationId: string }): Promise<Models.BackupRestoration>; + /** + * Get the current status of a backup restoration. + * + * @param {string} restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRestoration(restorationId: string): Promise<Models.BackupRestoration>; + getRestoration( + paramsOrFirst: { restorationId: string } | string + ): Promise<Models.BackupRestoration> { + let params: { restorationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { restorationId: string }; + } else { + params = { + restorationId: paramsOrFirst as string + }; + } + + const restorationId = params.restorationId; + + if (typeof restorationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "restorationId"'); + } + + const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/databases.ts b/src/services/databases.ts index 51a58d81..a25ed6df 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2,6 +2,10 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { RelationshipType } from '../enums/relationship-type'; +import { RelationMutate } from '../enums/relation-mutate'; +import { DatabasesIndexType } from '../enums/databases-index-type'; +import { OrderBy } from '../enums/order-by'; export class Databases { client: Client; @@ -10,6 +14,149 @@ export class Databases { this.client = client; } + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.DatabaseList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/databases'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Database. + * + * + * @param {string} params.databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. + */ + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Create a new Database. + * + * + * @param {string} databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create( + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/databases'; + const payload: Payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + /** * List transactions across all databases. * @@ -344,80 +491,239 @@ export class Databases { } /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. + */ + get(params: { databaseId: string }): Promise<Models.Database>; + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise<Models.Database>; + get( + paramsOrFirst: { databaseId: string } | string + ): Promise<Models.Database> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a database by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. + */ + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Update a database by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update( + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(databaseId: string): Promise<{}>; + delete( + paramsOrFirst: { databaseId: string } | string + ): Promise<{}> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @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<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. + * @returns {Promise<Models.CollectionList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; + listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity + * @param {string} search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @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<Models.DocumentList<Document>>} + * @returns {Promise<Models.CollectionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; - listDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; + listCollections( + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.CollectionList> { + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean }; } const databaseId = params.databaseId; - const collectionId = params.collectionId; const queries = params.queries; - const transactionId = params.transactionId; + const search = params.search; const total = params.total; - const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof search !== 'undefined') { + payload['search'] = search; } 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 } = { @@ -432,57 +738,4617 @@ export class Databases { } /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} params.documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. + * @param {string} params.collectionId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Collection name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {object[]} params.attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. + */ + createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; + /** + * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Collection name. Max length: 128 chars. + * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {object[]} attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; + createCollection( + paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + documentSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + attributes: rest[5] as object[], + indexes: rest[6] as object[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + const attributes = params.attributes; + const indexes = params.indexes; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof collectionId !== 'undefined') { + payload['collectionId'] = collectionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + payload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof attributes !== 'undefined') { + payload['attributes'] = attributes; + } + if (typeof indexes !== 'undefined') { + payload['indexes'] = indexes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. + */ + getCollection(params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; + /** + * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>; + getCollection( + paramsOrFirst: { databaseId: string, collectionId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a collection by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.name - Collection name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. + */ + updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; + /** + * Update a collection by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} name - Collection name. Max length: 128 chars. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; + updateCollection( + paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + documentSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + purge: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + const purge = params.purge; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + payload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. + */ + deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; + /** + * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteCollection(databaseId: string, collectionId: string): Promise<{}>; + deleteCollection( + paramsOrFirst: { databaseId: string, collectionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + 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 attributes in the collection. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection 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: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. + */ + listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; + /** + * List attributes in the collection. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection 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: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; + listAttributes( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.AttributeList> { + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead. + */ + createBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; + createBigIntAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.AttributeBigint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead. + */ + updateBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; + updateBigIntAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.AttributeBigint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a boolean attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. + */ + createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; + /** + * Create a boolean attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; + createBooleanAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeBoolean> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a boolean attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. + */ + updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; + /** + * Update a boolean attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; + updateBooleanAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.AttributeBoolean> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a date time attribute according to the ISO 8601 standard. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. + */ + createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; + /** + * Create a date time attribute according to the ISO 8601 standard. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; + createDatetimeAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeDatetime> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a date time attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. + */ + updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; + /** + * Update a date time attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; + updateDatetimeAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeDatetime> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an email attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. + */ + createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; + /** + * Create an email attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; + createEmailAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeEmail> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an email attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. + */ + updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; + /** + * Update an email attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; + updateEmailAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeEmail> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {string[]} params.elements - Array of enum values. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. + */ + createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; + /** + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {string[]} elements - Array of enum values. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; + createEnumAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeEnum> { + let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an enum attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {string[]} params.elements - Updated list of enum values. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. + */ + updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; + /** + * Update an enum attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {string[]} elements - Updated list of enum values. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; + updateEnumAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeEnum> { + let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a float attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number} params.min - Minimum value. + * @param {number} params.max - Maximum value. + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. + */ + createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; + /** + * Create a float attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number} min - Minimum value. + * @param {number} max - Maximum value. + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; + createFloatAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + ): Promise<Models.AttributeFloat> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number, + max: rest[4] as number, + xdefault: rest[5] as number, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a float attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {number} params.min - Minimum value. + * @param {number} params.max - Maximum value. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. + */ + updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; + /** + * Update a float attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {number} min - Minimum value. + * @param {number} max - Maximum value. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; + updateFloatAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.AttributeFloat> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number, + min: rest[4] as number, + max: rest[5] as number, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an integer attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. + */ + createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; + /** + * Create an integer attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; + createIntegerAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.AttributeInteger> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an integer attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. + */ + updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; + /** + * Update an integer attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; + updateIntegerAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.AttributeInteger> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create IP address attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. + */ + createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; + /** + * Create IP address attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; + createIpAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeIp> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an ip attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. + */ + updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; + /** + * Update an ip attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; + updateIpAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeIp> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric line attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. + */ + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; + /** + * Create a geometric line attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; + createLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributeLine> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. + */ + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; + updateLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributeLine> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a longtext attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + */ + createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; + /** + * Create a longtext attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; + createLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeLongtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + */ + updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; + /** + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; + updateLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeLongtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a mediumtext attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + */ + createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; + /** + * Create a mediumtext attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; + createMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeMediumtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + */ + updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; + /** + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; + updateMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeMediumtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric point attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + */ + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; + /** + * Create a geometric point attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; + createPointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributePoint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + */ + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; + updatePointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributePoint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric polygon attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + */ + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; + /** + * Create a geometric polygon attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; + createPolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributePolygon> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + */ + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; + updatePolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributePolygon> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.relatedCollectionId - Related Collection ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Attribute Key. + * @param {string} params.twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. + */ + createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} relatedCollectionId - Related Collection ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Attribute Key. + * @param {string} twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; + createRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise<Models.AttributeRelationship> { + let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + relatedCollectionId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const relatedCollectionId = params.relatedCollectionId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof relatedCollectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof relatedCollectionId !== 'undefined') { + payload['relatedCollectionId'] = relatedCollectionId; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof twoWay !== 'undefined') { + payload['twoWay'] = twoWay; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof twoWayKey !== 'undefined') { + payload['twoWayKey'] = twoWayKey; + } + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + */ + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; + updateRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise<Models.AttributeRelationship> { + let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a string attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for text attributes, in number of characters. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. + */ + createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; + /** + * Create a string attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for text attributes, in number of characters. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; + createStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a string attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the string attribute. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. + */ + updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; + /** + * Update a string attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the string attribute. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; + updateStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a text attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + */ + createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; + /** + * Create a text attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; + createTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeText> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a text attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + */ + updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; + /** + * Update a text attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; + updateTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeText> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a URL attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. + */ + createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; + /** + * Create a URL attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; + createUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeUrl> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an url attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. + */ + updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; + /** + * Update an url attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; + updateUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeUrl> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a varchar attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + */ + createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; + /** + * Create a varchar attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; + createVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeVarchar> { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a varchar attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the varchar attribute. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + */ + updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; + /** + * Update a varchar attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the varchar attribute. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVarcharAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; + updateVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.AttributeVarchar> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get attribute by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. + */ + getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + /** + * Get attribute by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + getAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + 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 + ); + } + + /** + * Deletes an attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. + */ + deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + /** + * Deletes an attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for 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<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. + */ + listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for 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<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; + listDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const transactionId = params.transactionId; + const total = params.total; + const ttl = params.ttl; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 + ); + } + + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} params.documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. + */ + createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON 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 {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; + createDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documentId !== 'undefined') { + payload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {object[]} params.documents - Array of documents data as JSON objects. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. + */ + createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {object[]} documents - Array of documents data as JSON objects. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; + createDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documents === 'undefined') { + throw new AppwriteException('Missing required parameter: "documents"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documents !== 'undefined') { + payload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. + */ + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {object[]} documents - Array of document data as JSON objects. May contain partial documents. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documents === 'undefined') { + throw new AppwriteException('Missing required parameter: "documents"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documents !== 'undefined') { + payload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {object} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. + */ + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {object} data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + updateDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (object)?, (string[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + data: rest[1] as object, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const data = params.data; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 + ); + } + + /** + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON 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 {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} - * @returns {Promise<Document>} + * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; - createDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, - documentId: rest[1] as string, - data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, - permissions: rest[3] as string[], - transactionId: rest[4] as string + queries: rest[1] as string[], + transactionId: rest[2] as string }; } const databaseId = params.databaseId; const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; + const queries = params.queries; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -491,23 +5357,11 @@ export class Databases { if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; - if (typeof documentId !== 'undefined') { - payload['documentId'] = documentId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -519,7 +5373,7 @@ export class Databases { } return this.client.call( - 'post', + 'delete', uri, apiHeaders, payload @@ -1051,4 +5905,320 @@ export class Databases { payload ); } + + /** + * List indexes in the collection. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} params.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: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IndexList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. + */ + listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; + /** + * List indexes in the collection. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} 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: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IndexList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; + listIndexes( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.IndexList> { + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + 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 + ); + } + + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @param {DatabasesIndexType} params.type - Index type. + * @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} params.lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. + */ + createIndex(params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @param {DatabasesIndexType} type - Index type. + * @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex(databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; + createIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + ): Promise<Models.Index> { + let params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + type: rest[2] as DatabasesIndexType, + attributes: rest[3] as string[], + orders: rest[4] as OrderBy[], + lengths: rest[5] as number[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const type = params.type; + const attributes = params.attributes; + const orders = params.orders; + const lengths = params.lengths; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof attributes === 'undefined') { + throw new AppwriteException('Missing required parameter: "attributes"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof attributes !== 'undefined') { + payload['attributes'] = attributes; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + payload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an index by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. + */ + getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; + /** + * Get an index by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>; + getIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Index> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + 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 index. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. + */ + deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + /** + * Delete an index. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + 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/functions.ts b/src/services/functions.ts index fc3f50ce..7ab63a5e 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -2,6 +2,11 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { Runtime } from '../enums/runtime'; +import { Scopes } from '../enums/scopes'; +import { TemplateReferenceType } from '../enums/template-reference-type'; +import { VCSReferenceType } from '../enums/vcs-reference-type'; +import { DeploymentDownloadType } from '../enums/deployment-download-type'; import { ExecutionMethod } from '../enums/execution-method'; export class Functions { @@ -11,31 +16,1660 @@ export class Functions { this.client = client; } + /** + * Get a list of all the project's functions. You can use the query params to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FunctionList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; + /** + * Get a list of all the project's functions. You can use the query params to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FunctionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.FunctionList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/functions'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + * + * @param {string} params.functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Function name. Max length: 128 chars. + * @param {Runtime} params.runtime - Execution runtime. + * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.timeout - Function maximum execution time in seconds. + * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} params.commands - Build Commands. + * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. + * @param {string} params.providerBranch - Production branch for the repo linked to the function. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the function deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the function executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + /** + * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + * + * @param {string} functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Function name. Max length: 128 chars. + * @param {Runtime} runtime - Execution runtime. + * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} timeout - Function maximum execution time in seconds. + * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} commands - Build Commands. + * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. + * @param {string} providerBranch - Production branch for the repo linked to the function. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string} buildSpecification - Build specification for the function deployments. + * @param {string} runtimeSpecification - Runtime specification for the function executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + create( + paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Function> { + let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + functionId: paramsOrFirst as string, + name: rest[0] as string, + runtime: rest[1] as Runtime, + execute: rest[2] as string[], + events: rest[3] as string[], + schedule: rest[4] as string, + timeout: rest[5] as number, + enabled: rest[6] as boolean, + logging: rest[7] as boolean, + entrypoint: rest[8] as string, + commands: rest[9] as string, + scopes: rest[10] as Scopes[], + installationId: rest[11] as string, + providerRepositoryId: rest[12] as string, + providerBranch: rest[13] as string, + providerSilentMode: rest[14] as boolean, + providerRootDirectory: rest[15] as string, + buildSpecification: rest[16] as string, + runtimeSpecification: rest[17] as string, + deploymentRetention: rest[18] as number + }; + } + + const functionId = params.functionId; + const name = params.name; + const runtime = params.runtime; + const execute = params.execute; + const events = params.events; + const schedule = params.schedule; + const timeout = params.timeout; + const enabled = params.enabled; + const logging = params.logging; + const entrypoint = params.entrypoint; + const commands = params.commands; + const scopes = params.scopes; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof runtime === 'undefined') { + throw new AppwriteException('Missing required parameter: "runtime"'); + } + + const apiPath = '/functions'; + const payload: Payload = {}; + if (typeof functionId !== 'undefined') { + payload['functionId'] = functionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all runtimes that are currently active on your instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.RuntimeList>} + */ + listRuntimes(): Promise<Models.RuntimeList> { + + const apiPath = '/functions/runtimes'; + 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 + ); + } + + /** + * List allowed function specifications for this instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.SpecificationList>} + */ + listSpecifications(): Promise<Models.SpecificationList> { + + const apiPath = '/functions/specifications'; + 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 + ); + } + + /** + * Get a function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + get(params: { functionId: string }): Promise<Models.Function>; + /** + * Get a function by its unique ID. + * + * @param {string} functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(functionId: string): Promise<Models.Function>; + get( + paramsOrFirst: { functionId: string } | string + ): Promise<Models.Function> { + let params: { functionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string }; + } else { + params = { + functionId: paramsOrFirst as string + }; + } + + const functionId = params.functionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.name - Function name. Max length: 128 chars. + * @param {Runtime} params.runtime - Execution runtime. + * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.timeout - Maximum execution time in seconds. + * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} params.commands - Build Commands. + * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function + * @param {string} params.providerBranch - Production branch for the repo linked to the function + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the function deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the function executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + /** + * Update function by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} name - Function name. Max length: 128 chars. + * @param {Runtime} runtime - Execution runtime. + * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} timeout - Maximum execution time in seconds. + * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} commands - Build Commands. + * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the function + * @param {string} providerBranch - Production branch for the repo linked to the function + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string} buildSpecification - Build specification for the function deployments. + * @param {string} runtimeSpecification - Runtime specification for the function executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + update( + paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Function> { + let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + functionId: paramsOrFirst as string, + name: rest[0] as string, + runtime: rest[1] as Runtime, + execute: rest[2] as string[], + events: rest[3] as string[], + schedule: rest[4] as string, + timeout: rest[5] as number, + enabled: rest[6] as boolean, + logging: rest[7] as boolean, + entrypoint: rest[8] as string, + commands: rest[9] as string, + scopes: rest[10] as Scopes[], + installationId: rest[11] as string, + providerRepositoryId: rest[12] as string, + providerBranch: rest[13] as string, + providerSilentMode: rest[14] as boolean, + providerRootDirectory: rest[15] as string, + buildSpecification: rest[16] as string, + runtimeSpecification: rest[17] as string, + deploymentRetention: rest[18] as number + }; + } + + const functionId = params.functionId; + const name = params.name; + const runtime = params.runtime; + const execute = params.execute; + const events = params.events; + const schedule = params.schedule; + const timeout = params.timeout; + const enabled = params.enabled; + const logging = params.logging; + const entrypoint = params.entrypoint; + const commands = params.commands; + const scopes = params.scopes; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { functionId: string }): Promise<{}>; + /** + * Delete a function by its unique ID. + * + * @param {string} functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(functionId: string): Promise<{}>; + delete( + paramsOrFirst: { functionId: string } | string + ): Promise<{}> { + let params: { functionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string }; + } else { + params = { + functionId: paramsOrFirst as string + }; + } + + const functionId = params.functionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Function>; + /** + * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFunctionDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; + updateFunctionDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Function> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all the function's code deployments. You can use the query params to filter your results. + * + * @param {string} params.functionId - Function 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + */ + listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; + /** + * Get a list of all the function's code deployments. You can use the query params to filter your results. + * + * @param {string} functionId - Function 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; + listDeployments( + paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.DeploymentList> { + let params: { functionId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const functionId = params.functionId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. + * + * @param {string} params.functionId - Function ID. + * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @param {string} params.entrypoint - Entrypoint File. + * @param {string} params.commands - Build Commands. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDeployment(params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; + /** + * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. + * + * @param {string} functionId - Function ID. + * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @param {string} entrypoint - Entrypoint File. + * @param {string} commands - Build Commands. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string }; + let onProgress: ((progress: UploadProgress) => void); + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + functionId: paramsOrFirst as string, + code: rest[0] as File, + activate: rest[1] as boolean, + entrypoint: rest[2] as string, + commands: rest[3] as string + }; + onProgress = rest[4] as ((progress: UploadProgress) => void); + } + + const functionId = params.functionId; + const code = params.code; + const activate = params.activate; + const entrypoint = params.entrypoint; + const commands = params.commands; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + if (typeof activate === 'undefined') { + throw new AppwriteException('Missing required parameter: "activate"'); + } + + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'multipart/form-data', + } + + return this.client.chunkedUpload( + 'post', + uri, + apiHeaders, + payload, + onProgress + ); + } + + /** + * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {string} params.buildId - Build unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; + /** + * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @param {string} buildId - Build unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; + createDuplicateDeployment( + paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string, buildId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, buildId?: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string, + buildId: rest[1] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + const buildId = params.buildId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + if (typeof buildId !== 'undefined') { + payload['buildId'] = buildId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.repository - Repository name of the template. + * @param {string} params.owner - The name of the owner of the template. + * @param {string} params.rootDirectory - Path to function code in the template repo. + * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. + * + * @param {string} functionId - Function ID. + * @param {string} repository - Repository name of the template. + * @param {string} owner - The name of the owner of the template. + * @param {string} rootDirectory - Path to function code in the template repo. + * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createTemplateDeployment( + paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + repository: rest[0] as string, + owner: rest[1] as string, + rootDirectory: rest[2] as string, + type: rest[3] as TemplateReferenceType, + reference: rest[4] as string, + activate: rest[5] as boolean + }; + } + + const functionId = params.functionId; + const repository = params.repository; + const owner = params.owner; + const rootDirectory = params.rootDirectory; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof repository === 'undefined') { + throw new AppwriteException('Missing required parameter: "repository"'); + } + if (typeof owner === 'undefined') { + throw new AppwriteException('Missing required parameter: "owner"'); + } + if (typeof rootDirectory === 'undefined') { + throw new AppwriteException('Missing required parameter: "rootDirectory"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof repository !== 'undefined') { + payload['repository'] = repository; + } + if (typeof owner !== 'undefined') { + payload['owner'] = owner; + } + if (typeof rootDirectory !== 'undefined') { + payload['rootDirectory'] = rootDirectory; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a deployment when a function is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} params.functionId - Function ID. + * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit + * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment when a function is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} functionId - Function ID. + * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit + * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createVcsDeployment( + paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + type: rest[0] as VCSReferenceType, + reference: rest[1] as string, + activate: rest[2] as boolean + }; + } + + const functionId = params.functionId; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a function deployment by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + getDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Get a function deployment by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; + getDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + 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 code deployment by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; + /** + * Delete a code deployment by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; + deleteDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {string} + */ + getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + /** + * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {string} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload( + paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): string { + let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string, + type: rest[1] as DeploymentDownloadType + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + const type = params.type; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + payload['project'] = this.client.config.project; + payload['key'] = this.client.config.key; + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + + return uri.toString(); + } + + /** + * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>; + updateDeploymentStatus( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + 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( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * + * @param {string} params.functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + */ + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * + * @param {string} functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listExecutions( + paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.ExecutionList> { + let params: { functionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const functionId = params.functionId; + const queries = params.queries; + const total = params.total; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + 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 + ); + } + + /** + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.body - HTTP body of execution. Default value is empty string. + * @param {boolean} params.async - Execute code in the background. Default value is false. + * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. + * @param {object} params.headers - HTTP headers of execution. Defaults to empty. + * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; + /** + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * + * @param {string} functionId - Function ID. + * @param {string} body - HTTP body of execution. Default value is empty string. + * @param {boolean} async - Execute code in the background. Default value is false. + * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. + * @param {object} headers - HTTP headers of execution. Defaults to empty. + * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; + createExecution( + paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] + ): Promise<Models.Execution> { + let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + } else { + params = { + functionId: paramsOrFirst as string, + body: rest[0] as string, + async: rest[1] as boolean, + xpath: rest[2] as string, + method: rest[3] as ExecutionMethod, + headers: rest[4] as object, + scheduledAt: rest[5] as string + }; + } + + const functionId = params.functionId; + const body = params.body; + const async = params.async; + const xpath = params.xpath; + const method = params.method; + const headers = params.headers; + const scheduledAt = params.scheduledAt; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof async !== 'undefined') { + payload['async'] = async; + } + if (typeof xpath !== 'undefined') { + payload['path'] = xpath; + } + if (typeof method !== 'undefined') { + payload['method'] = method; + } + if (typeof headers !== 'undefined') { + payload['headers'] = headers; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a function execution log by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; + /** + * Get a function execution log by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getExecution(functionId: string, executionId: string): Promise<Models.Execution>; + getExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Execution> { + let params: { functionId: string, executionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + executionId: rest[0] as string + }; + } + + const functionId = params.functionId; + const executionId = params.executionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + 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 function execution by its unique ID. + * * @param {string} params.functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {string} params.executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} + * @returns {Promise<{}>} */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; + deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * Delete a function execution by its unique ID. * * @param {string} functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {string} executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteExecution(functionId: string, executionId: string): Promise<{}>; + deleteExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, executionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + executionId: rest[0] as string + }; + } + + const functionId = params.functionId; + const executionId = params.executionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all variables of a specific function. + * + * @param {string} params.functionId - Function unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all variables of a specific function. + * + * @param {string} functionId - Function unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} + * @returns {Promise<Models.VariableList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listExecutions( + listVariables(functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { + ): Promise<Models.VariableList> { let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -56,7 +1690,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -78,85 +1712,80 @@ export class Functions { } /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * - * @param {string} params.functionId - Function ID. - * @param {string} params.body - HTTP body of execution. Default value is empty string. - * @param {boolean} params.async - Execute code in the background. Default value is false. - * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. - * @param {object} params.headers - HTTP headers of execution. Defaults to empty. - * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable 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.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; + createVariable(params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * - * @param {string} functionId - Function ID. - * @param {string} body - HTTP body of execution. Default value is empty string. - * @param {boolean} async - Execute code in the background. Default value is false. - * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. - * @param {object} headers - HTTP headers of execution. Defaults to empty. - * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable 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} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} * @deprecated Use the object parameter style method for a better developer experience. */ - createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; - createExecution( - paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; } else { params = { functionId: paramsOrFirst as string, - body: rest[0] as string, - async: rest[1] as boolean, - xpath: rest[2] as string, - method: rest[3] as ExecutionMethod, - headers: rest[4] as object, - scheduledAt: rest[5] as string + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean }; } const functionId = params.functionId; - const body = params.body; - const async = params.async; - const xpath = params.xpath; - const method = params.method; - const headers = params.headers; - const scheduledAt = params.scheduledAt; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof body !== 'undefined') { - payload['body'] = body; + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); } - if (typeof async !== 'undefined') { - payload['async'] = async; + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); } - if (typeof xpath !== 'undefined') { - payload['path'] = xpath; + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); } - if (typeof method !== 'undefined') { - payload['method'] = method; + + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; } - if (typeof headers !== 'undefined') { - payload['headers'] = headers; + if (typeof key !== 'undefined') { + payload['key'] = key; } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -173,50 +1802,50 @@ export class Functions { } /** - * Get a function execution log by its unique ID. + * Get a variable by its unique ID. * - * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} */ - getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; + getVariable(params: { functionId: string, variableId: string }): Promise<Models.Variable>; /** - * Get a function execution log by its unique ID. + * Get a variable by its unique ID. * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} * @deprecated Use the object parameter style method for a better developer experience. */ - getExecution(functionId: string, executionId: string): Promise<Models.Execution>; - getExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, + getVariable(functionId: string, variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { functionId: string, variableId: string } | string, ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, executionId: string }; + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; } else { params = { functionId: paramsOrFirst as string, - executionId: rest[0] as string + variableId: rest[0] as string }; } const functionId = params.functionId; - const executionId = params.executionId; + const variableId = params.variableId; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -230,4 +1859,145 @@ export class Functions { payload ); } + + /** + * Update variable by its unique ID. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(functionId: string, variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { functionId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + 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/health.ts b/src/services/health.ts new file mode 100644 index 00000000..259b4e98 --- /dev/null +++ b/src/services/health.ts @@ -0,0 +1,1043 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { Name } from '../enums/name'; + +export class Health { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + get(): Promise<Models.HealthStatus> { + + const apiPath = '/health'; + 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 + ); + } + + /** + * Check the Appwrite Antivirus server is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthAntivirus>} + */ + getAntivirus(): Promise<Models.HealthAntivirus> { + + const apiPath = '/health/anti-virus'; + 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 + ); + } + + /** + * Check the Appwrite in-memory cache servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getCache(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/cache'; + 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 + ); + } + + /** + * Get the SSL certificate for a domain + * + * @param {string} params.domain - string + * @throws {AppwriteException} + * @returns {Promise<Models.HealthCertificate>} + */ + getCertificate(params?: { domain?: string }): Promise<Models.HealthCertificate>; + /** + * Get the SSL certificate for a domain + * + * @param {string} domain - string + * @throws {AppwriteException} + * @returns {Promise<Models.HealthCertificate>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCertificate(domain?: string): Promise<Models.HealthCertificate>; + getCertificate( + paramsOrFirst?: { domain?: string } | string + ): Promise<Models.HealthCertificate> { + let params: { domain?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain?: string }; + } else { + params = { + domain: paramsOrFirst as string + }; + } + + const domain = params.domain; + + + const apiPath = '/health/certificate'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise<Models.HealthStatus>; + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsolePausing(threshold?: number, inactivityDays?: number): Promise<Models.HealthStatus>; + getConsolePausing( + paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, + ...rest: [(number)?] + ): Promise<Models.HealthStatus> { + let params: { threshold?: number, inactivityDays?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; + } else { + params = { + threshold: paramsOrFirst as number, + inactivityDays: rest[0] as number + }; + } + + const threshold = params.threshold; + const inactivityDays = params.inactivityDays; + + + const apiPath = '/health/console-pausing'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + if (typeof inactivityDays !== 'undefined') { + payload['inactivityDays'] = inactivityDays; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Check the Appwrite database servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getDB(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/db'; + 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 + ); + } + + /** + * Check the Appwrite pub-sub servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getPubSub(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/pubsub'; + 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 + ); + } + + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueAudits(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueAudits(threshold?: number): Promise<Models.HealthQueue>; + getQueueAudits( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/audits'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueBuilds(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>; + getQueueBuilds( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/builds'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueCertificates(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>; + getQueueCertificates( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/certificates'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {string} params.name - Queue name for which to check the queue size + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueDatabases(params?: { name?: string, threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {string} name - Queue name for which to check the queue size + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>; + getQueueDatabases( + paramsOrFirst?: { name?: string, threshold?: number } | string, + ...rest: [(number)?] + ): Promise<Models.HealthQueue> { + let params: { name?: string, threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name?: string, threshold?: number }; + } else { + params = { + name: paramsOrFirst as string, + threshold: rest[0] as number + }; + } + + const name = params.name; + const threshold = params.threshold; + + + const apiPath = '/health/queue/databases'; + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueDeletes(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>; + getQueueDeletes( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/deletes'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Returns the amount of failed jobs in a given queue. + * + * + * @param {Name} params.name - The name of the queue + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getFailedJobs(params: { name: Name, threshold?: number }): Promise<Models.HealthQueue>; + /** + * Returns the amount of failed jobs in a given queue. + * + * + * @param {Name} name - The name of the queue + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>; + getFailedJobs( + paramsOrFirst: { name: Name, threshold?: number } | Name, + ...rest: [(number)?] + ): Promise<Models.HealthQueue> { + let params: { name: Name, threshold?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name: Name, threshold?: number }; + } else { + params = { + name: paramsOrFirst as Name, + threshold: rest[0] as number + }; + } + + const name = params.name; + const threshold = params.threshold; + + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/health/queue/failed/{name}'.replace('{name}', name); + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueFunctions(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>; + getQueueFunctions( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/functions'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueLogs(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueLogs(threshold?: number): Promise<Models.HealthQueue>; + getQueueLogs( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/logs'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMails(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMails(threshold?: number): Promise<Models.HealthQueue>; + getQueueMails( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/mails'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMessaging(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>; + getQueueMessaging( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/messaging'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMigrations(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>; + getQueueMigrations( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/migrations'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueStatsResources(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>; + getQueueStatsResources( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/stats-resources'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueUsage(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueUsage(threshold?: number): Promise<Models.HealthQueue>; + getQueueUsage( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/stats-usage'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueWebhooks(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>; + getQueueWebhooks( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/webhooks'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Check the Appwrite storage device is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getStorage(): Promise<Models.HealthStatus> { + + const apiPath = '/health/storage'; + 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 + ); + } + + /** + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getStorageLocal(): Promise<Models.HealthStatus> { + + const apiPath = '/health/storage/local'; + 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 + ); + } + + /** + * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthTime>} + */ + getTime(): Promise<Models.HealthTime> { + + const apiPath = '/health/time'; + 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/messaging.ts b/src/services/messaging.ts index d6c45bcd..89c754fd 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -2,6 +2,8 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { MessagePriority } from '../enums/message-priority'; +import { SmtpEncryption } from '../enums/smtp-encryption'; export class Messaging { client: Client; @@ -10,6 +12,4992 @@ export class Messaging { this.client = client; } + /** + * Get a list of all messages from the current Appwrite project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MessageList>} + */ + listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; + /** + * Get a list of all messages from the current Appwrite project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MessageList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMessages(queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; + listMessages( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.MessageList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/messages'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new email message. + * + * @param {string} params.messageId - Message 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.subject - Email Subject. + * @param {string} params.content - Email Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string[]} params.cc - Array of target IDs to be added as CC. + * @param {string[]} params.bcc - Array of target IDs to be added as BCC. + * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {boolean} params.draft - Is message a draft + * @param {boolean} params.html - Is content of type HTML + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new email message. + * + * @param {string} messageId - Message 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} subject - Email Subject. + * @param {string} content - Email Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string[]} cc - Array of target IDs to be added as CC. + * @param {string[]} bcc - Array of target IDs to be added as BCC. + * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {boolean} draft - Is message a draft + * @param {boolean} html - Is content of type HTML + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; + createEmail( + paramsOrFirst: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + subject: rest[0] as string, + content: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], + cc: rest[5] as string[], + bcc: rest[6] as string[], + attachments: rest[7] as string[], + draft: rest[8] as boolean, + html: rest[9] as boolean, + scheduledAt: rest[10] as string + }; + } + + const messageId = params.messageId; + const subject = params.subject; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const cc = params.cc; + const bcc = params.bcc; + const attachments = params.attachments; + const draft = params.draft; + const html = params.html; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof subject === 'undefined') { + throw new AppwriteException('Missing required parameter: "subject"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/email'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof cc !== 'undefined') { + payload['cc'] = cc; + } + if (typeof bcc !== 'undefined') { + payload['bcc'] = bcc; + } + if (typeof attachments !== 'undefined') { + payload['attachments'] = attachments; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof html !== 'undefined') { + payload['html'] = html; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.subject - Email Subject. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {boolean} params.html - Is content of type HTML + * @param {string[]} params.cc - Array of target IDs to be added as CC. + * @param {string[]} params.bcc - Array of target IDs to be added as BCC. + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; + /** + * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} subject - Email Subject. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {boolean} html - Is content of type HTML + * @param {string[]} cc - Array of target IDs to be added as CC. + * @param {string[]} bcc - Array of target IDs to be added as BCC. + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; + updateEmail( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (boolean)?, (string[])?, (string[])?, (string)?, (string[])?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + subject: rest[3] as string, + content: rest[4] as string, + draft: rest[5] as boolean, + html: rest[6] as boolean, + cc: rest[7] as string[], + bcc: rest[8] as string[], + scheduledAt: rest[9] as string, + attachments: rest[10] as string[] + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const subject = params.subject; + const content = params.content; + const draft = params.draft; + const html = params.html; + const cc = params.cc; + const bcc = params.bcc; + const scheduledAt = params.scheduledAt; + const attachments = params.attachments; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof html !== 'undefined') { + payload['html'] = html; + } + if (typeof cc !== 'undefined') { + payload['cc'] = cc; + } + if (typeof bcc !== 'undefined') { + payload['bcc'] = bcc; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof attachments !== 'undefined') { + payload['attachments'] = attachments; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new push notification. + * + * @param {string} params.messageId - Message 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.title - Title for push notification. + * @param {string} params.body - Body for push notification. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {object} params.data - Additional key-value pair data for push notification. + * @param {string} params.action - Action for push notification. + * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} params.icon - Icon for push notification. Available only for Android and Web Platform. + * @param {string} params.sound - Sound for push notification. Available only for Android and iOS Platform. + * @param {string} params.color - Color for push notification. Available only for Android Platform. + * @param {string} params.tag - Tag for push notification. Available only for Android Platform. + * @param {number} params.badge - Badge for push notification. Available only for iOS Platform. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + /** + * Create a new push notification. + * + * @param {string} messageId - Message 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} title - Title for push notification. + * @param {string} body - Body for push notification. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {object} data - Additional key-value pair data for push notification. + * @param {string} action - Action for push notification. + * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} icon - Icon for push notification. Available only for Android and Web Platform. + * @param {string} sound - Sound for push notification. Available only for Android and iOS Platform. + * @param {string} color - Color for push notification. Available only for Android Platform. + * @param {string} tag - Tag for push notification. Available only for Android Platform. + * @param {number} badge - Badge for push notification. Available only for iOS Platform. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + createPush( + paramsOrFirst: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, + ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] + ): Promise<Models.Message> { + let params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + } else { + params = { + messageId: paramsOrFirst as string, + title: rest[0] as string, + body: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], + data: rest[5] as object, + action: rest[6] as string, + image: rest[7] as string, + icon: rest[8] as string, + sound: rest[9] as string, + color: rest[10] as string, + tag: rest[11] as string, + badge: rest[12] as number, + draft: rest[13] as boolean, + scheduledAt: rest[14] as string, + contentAvailable: rest[15] as boolean, + critical: rest[16] as boolean, + priority: rest[17] as MessagePriority + }; + } + + const messageId = params.messageId; + const title = params.title; + const body = params.body; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const data = params.data; + const action = params.action; + const image = params.image; + const icon = params.icon; + const sound = params.sound; + const color = params.color; + const tag = params.tag; + const badge = params.badge; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + const contentAvailable = params.contentAvailable; + const critical = params.critical; + const priority = params.priority; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/push'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof title !== 'undefined') { + payload['title'] = title; + } + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof action !== 'undefined') { + payload['action'] = action; + } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { + payload['icon'] = icon; + } + if (typeof sound !== 'undefined') { + payload['sound'] = sound; + } + if (typeof color !== 'undefined') { + payload['color'] = color; + } + if (typeof tag !== 'undefined') { + payload['tag'] = tag; + } + if (typeof badge !== 'undefined') { + payload['badge'] = badge; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof contentAvailable !== 'undefined') { + payload['contentAvailable'] = contentAvailable; + } + if (typeof critical !== 'undefined') { + payload['critical'] = critical; + } + if (typeof priority !== 'undefined') { + payload['priority'] = priority; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.title - Title for push notification. + * @param {string} params.body - Body for push notification. + * @param {object} params.data - Additional Data for push notification. + * @param {string} params.action - Action for push notification. + * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} params.icon - Icon for push notification. Available only for Android and Web platforms. + * @param {string} params.sound - Sound for push notification. Available only for Android and iOS platforms. + * @param {string} params.color - Color for push notification. Available only for Android platforms. + * @param {string} params.tag - Tag for push notification. Available only for Android platforms. + * @param {number} params.badge - Badge for push notification. Available only for iOS platforms. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + /** + * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} title - Title for push notification. + * @param {string} body - Body for push notification. + * @param {object} data - Additional Data for push notification. + * @param {string} action - Action for push notification. + * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} icon - Icon for push notification. Available only for Android and Web platforms. + * @param {string} sound - Sound for push notification. Available only for Android and iOS platforms. + * @param {string} color - Color for push notification. Available only for Android platforms. + * @param {string} tag - Tag for push notification. Available only for Android platforms. + * @param {number} badge - Badge for push notification. Available only for iOS platforms. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + updatePush( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + title: rest[3] as string, + body: rest[4] as string, + data: rest[5] as object, + action: rest[6] as string, + image: rest[7] as string, + icon: rest[8] as string, + sound: rest[9] as string, + color: rest[10] as string, + tag: rest[11] as string, + badge: rest[12] as number, + draft: rest[13] as boolean, + scheduledAt: rest[14] as string, + contentAvailable: rest[15] as boolean, + critical: rest[16] as boolean, + priority: rest[17] as MessagePriority + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const title = params.title; + const body = params.body; + const data = params.data; + const action = params.action; + const image = params.image; + const icon = params.icon; + const sound = params.sound; + const color = params.color; + const tag = params.tag; + const badge = params.badge; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + const contentAvailable = params.contentAvailable; + const critical = params.critical; + const priority = params.priority; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof title !== 'undefined') { + payload['title'] = title; + } + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof action !== 'undefined') { + payload['action'] = action; + } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { + payload['icon'] = icon; + } + if (typeof sound !== 'undefined') { + payload['sound'] = sound; + } + if (typeof color !== 'undefined') { + payload['color'] = color; + } + if (typeof tag !== 'undefined') { + payload['tag'] = tag; + } + if (typeof badge !== 'undefined') { + payload['badge'] = badge; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof contentAvailable !== 'undefined') { + payload['contentAvailable'] = contentAvailable; + } + if (typeof critical !== 'undefined') { + payload['critical'] = critical; + } + if (typeof priority !== 'undefined') { + payload['priority'] = priority; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new SMS message. + * + * @param {string} params.messageId - Message 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.content - SMS Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. + */ + createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new SMS message. + * + * @param {string} messageId - Message 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} content - SMS Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSms( + paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/sms'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new SMS message. + * + * @param {string} params.messageId - Message 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.content - SMS Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new SMS message. + * + * @param {string} messageId - Message 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} content - SMS Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMS(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSMS( + paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/sms'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. + */ + updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSms( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + content: rest[3] as string, + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const content = params.content; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSMS(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSMS( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + content: rest[3] as string, + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const content = params.content; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a message by its unique ID. + * + * + * @param {string} params.messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + getMessage(params: { messageId: string }): Promise<Models.Message>; + /** + * Get a message by its unique ID. + * + * + * @param {string} messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMessage(messageId: string): Promise<Models.Message>; + getMessage( + paramsOrFirst: { messageId: string } | string + ): Promise<Models.Message> { + let params: { messageId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string }; + } else { + params = { + messageId: paramsOrFirst as string + }; + } + + const messageId = params.messageId; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + 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 message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + * + * @param {string} params.messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { messageId: string }): Promise<{}>; + /** + * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + * + * @param {string} messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(messageId: string): Promise<{}>; + delete( + paramsOrFirst: { messageId: string } | string + ): Promise<{}> { + let params: { messageId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string }; + } else { + params = { + messageId: paramsOrFirst as string + }; + } + + const messageId = params.messageId; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the message activity logs listed by its unique ID. + * + * @param {string} params.messageId - Message 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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the message activity logs listed by its unique ID. + * + * @param {string} messageId - Message 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). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listMessageLogs( + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { messageId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; + } else { + params = { + messageId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const messageId = params.messageId; + const queries = params.queries; + const total = params.total; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}/logs'.replace('{messageId}', messageId); + 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 a list of the targets associated with a message. + * + * @param {string} params.messageId - Message 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: userId, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + */ + listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; + /** + * Get a list of the targets associated with a message. + * + * @param {string} messageId - Message 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: userId, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTargets(messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; + listTargets( + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.TargetList> { + let params: { messageId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; + } else { + params = { + messageId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const messageId = params.messageId; + const queries = params.queries; + const total = params.total; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', messageId); + 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 a list of all providers from the current Appwrite project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProviderList>} + */ + listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; + /** + * Get a list of all providers from the current Appwrite project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProviderList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProviders(queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; + listProviders( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.ProviderList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/providers'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. + */ + createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createApnsProvider( + paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + authKey: rest[1] as string, + authKeyId: rest[2] as string, + teamId: rest[3] as string, + bundleId: rest[4] as string, + sandbox: rest[5] as boolean, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/apns'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAPNSProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createAPNSProvider( + paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + authKey: rest[1] as string, + authKeyId: rest[2] as string, + teamId: rest[3] as string, + bundleId: rest[4] as string, + sandbox: rest[5] as boolean, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/apns'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. + */ + updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateApnsProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + authKey: rest[2] as string, + authKeyId: rest[3] as string, + teamId: rest[4] as string, + bundleId: rest[5] as string, + sandbox: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAPNSProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateAPNSProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + authKey: rest[2] as string, + authKeyId: rest[3] as string, + teamId: rest[4] as string, + bundleId: rest[5] as string, + sandbox: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. + */ + createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFcmProvider( + paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, + ...rest: [(string)?, (object)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + serviceAccountJSON: rest[1] as object, + enabled: rest[2] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const serviceAccountJSON = params.serviceAccountJSON; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/fcm'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFCMProvider( + paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, + ...rest: [(string)?, (object)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + serviceAccountJSON: rest[1] as object, + enabled: rest[2] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const serviceAccountJSON = params.serviceAccountJSON; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/fcm'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. + */ + updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFcmProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, + ...rest: [(string)?, (boolean)?, (object)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + serviceAccountJSON: rest[2] as object + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const serviceAccountJSON = params.serviceAccountJSON; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFCMProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFCMProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, + ...rest: [(string)?, (boolean)?, (object)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + serviceAccountJSON: rest[2] as object + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const serviceAccountJSON = params.serviceAccountJSON; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Mailgun provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Mailgun API Key. + * @param {string} params.domain - Mailgun Domain. + * @param {boolean} params.isEuRegion - Set as EU region. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Mailgun provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} apiKey - Mailgun API Key. + * @param {string} domain - Mailgun Domain. + * @param {boolean} isEuRegion - Set as EU region. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createMailgunProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + domain: rest[2] as string, + isEuRegion: rest[3] as boolean, + fromName: rest[4] as string, + fromEmail: rest[5] as string, + replyToName: rest[6] as string, + replyToEmail: rest[7] as string, + enabled: rest[8] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const domain = params.domain; + const isEuRegion = params.isEuRegion; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/mailgun'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof isEuRegion !== 'undefined') { + payload['isEuRegion'] = isEuRegion; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Mailgun provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Mailgun API Key. + * @param {string} params.domain - Mailgun Domain. + * @param {boolean} params.isEuRegion - Set as EU region. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Mailgun provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} apiKey - Mailgun API Key. + * @param {string} domain - Mailgun Domain. + * @param {boolean} isEuRegion - Set as EU region. + * @param {boolean} enabled - Set as enabled. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateMailgunProvider( + paramsOrFirst: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + domain: rest[2] as string, + isEuRegion: rest[3] as boolean, + enabled: rest[4] as boolean, + fromName: rest[5] as string, + fromEmail: rest[6] as string, + replyToName: rest[7] as string, + replyToEmail: rest[8] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const domain = params.domain; + const isEuRegion = params.isEuRegion; + const enabled = params.enabled; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof isEuRegion !== 'undefined') { + payload['isEuRegion'] = isEuRegion; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new MSG91 provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.templateId - Msg91 template ID + * @param {string} params.senderId - Msg91 sender ID. + * @param {string} params.authKey - Msg91 auth key. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new MSG91 provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} templateId - Msg91 template ID + * @param {string} senderId - Msg91 sender ID. + * @param {string} authKey - Msg91 auth key. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; + createMsg91Provider( + paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + templateId: rest[1] as string, + senderId: rest[2] as string, + authKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const templateId = params.templateId; + const senderId = params.senderId; + const authKey = params.authKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/msg91'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof senderId !== 'undefined') { + payload['senderId'] = senderId; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a MSG91 provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.templateId - Msg91 template ID. + * @param {string} params.senderId - Msg91 sender ID. + * @param {string} params.authKey - Msg91 auth key. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; + /** + * Update a MSG91 provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} templateId - Msg91 template ID. + * @param {string} senderId - Msg91 sender ID. + * @param {string} authKey - Msg91 auth key. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; + updateMsg91Provider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + templateId: rest[2] as string, + senderId: rest[3] as string, + authKey: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const templateId = params.templateId; + const senderId = params.senderId; + const authKey = params.authKey; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof senderId !== 'undefined') { + payload['senderId'] = senderId; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Resend provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Resend provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createResendProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createResendProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + fromName: rest[2] as string, + fromEmail: rest[3] as string, + replyToName: rest[4] as string, + replyToEmail: rest[5] as string, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/resend'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Resend provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Resend provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateResendProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateResendProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + fromName: rest[3] as string, + fromEmail: rest[4] as string, + replyToName: rest[5] as string, + replyToEmail: rest[6] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Sendgrid provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Sendgrid API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Sendgrid provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} apiKey - Sendgrid API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSendgridProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + fromName: rest[2] as string, + fromEmail: rest[3] as string, + replyToName: rest[4] as string, + replyToEmail: rest[5] as string, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/sendgrid'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Sendgrid provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Sendgrid API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Sendgrid provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Sendgrid API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateSendgridProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + fromName: rest[3] as string, + fromEmail: rest[4] as string, + replyToName: rest[5] as string, + replyToEmail: rest[6] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new SMTP provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - The default SMTP server port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. + */ + createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new SMTP provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - The default SMTP server port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSmtpProvider( + paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof host === 'undefined') { + throw new AppwriteException('Missing required parameter: "host"'); + } + + const apiPath = '/messaging/providers/smtp'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new SMTP provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - The default SMTP server port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new SMTP provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - The default SMTP server port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMTPProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSMTPProvider( + paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof host === 'undefined') { + throw new AppwriteException('Missing required parameter: "host"'); + } + + const apiPath = '/messaging/providers/smtp'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - SMTP port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. + */ + updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - SMTP port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSmtpProvider( + paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - SMTP port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - SMTP port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSMTPProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSMTPProvider( + paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Telesign provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.customerId - Telesign customer ID. + * @param {string} params.apiKey - Telesign API key. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Telesign provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} customerId - Telesign customer ID. + * @param {string} apiKey - Telesign API key. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTelesignProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + customerId: rest[2] as string, + apiKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const customerId = params.customerId; + const apiKey = params.apiKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/telesign'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof customerId !== 'undefined') { + payload['customerId'] = customerId; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Telesign provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.customerId - Telesign customer ID. + * @param {string} params.apiKey - Telesign API key. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Telesign provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} customerId - Telesign customer ID. + * @param {string} apiKey - Telesign API key. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTelesignProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + customerId: rest[2] as string, + apiKey: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const customerId = params.customerId; + const apiKey = params.apiKey; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof customerId !== 'undefined') { + payload['customerId'] = customerId; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Textmagic provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.username - Textmagic username. + * @param {string} params.apiKey - Textmagic apiKey. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Textmagic provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} username - Textmagic username. + * @param {string} apiKey - Textmagic apiKey. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTextmagicProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + username: rest[2] as string, + apiKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const username = params.username; + const apiKey = params.apiKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/textmagic'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Textmagic provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.username - Textmagic username. + * @param {string} params.apiKey - Textmagic apiKey. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Textmagic provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} username - Textmagic username. + * @param {string} apiKey - Textmagic apiKey. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTextmagicProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + username: rest[2] as string, + apiKey: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const username = params.username; + const apiKey = params.apiKey; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Twilio provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.accountSid - Twilio account secret ID. + * @param {string} params.authToken - Twilio authentication token. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Twilio provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} accountSid - Twilio account secret ID. + * @param {string} authToken - Twilio authentication token. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; + createTwilioProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + accountSid: rest[2] as string, + authToken: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const accountSid = params.accountSid; + const authToken = params.authToken; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/twilio'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof accountSid !== 'undefined') { + payload['accountSid'] = accountSid; + } + if (typeof authToken !== 'undefined') { + payload['authToken'] = authToken; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Twilio provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.accountSid - Twilio account secret ID. + * @param {string} params.authToken - Twilio authentication token. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Twilio provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} accountSid - Twilio account secret ID. + * @param {string} authToken - Twilio authentication token. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; + updateTwilioProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + accountSid: rest[2] as string, + authToken: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const accountSid = params.accountSid; + const authToken = params.authToken; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof accountSid !== 'undefined') { + payload['accountSid'] = accountSid; + } + if (typeof authToken !== 'undefined') { + payload['authToken'] = authToken; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Vonage provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.apiKey - Vonage API key. + * @param {string} params.apiSecret - Vonage API secret. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Vonage provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} apiKey - Vonage API key. + * @param {string} apiSecret - Vonage API secret. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; + createVonageProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + apiKey: rest[2] as string, + apiSecret: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/vonage'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Vonage provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Vonage API key. + * @param {string} params.apiSecret - Vonage API secret. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Vonage provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Vonage API key. + * @param {string} apiSecret - Vonage API secret. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; + updateVonageProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + apiSecret: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a provider by its unique ID. + * + * + * @param {string} params.providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + getProvider(params: { providerId: string }): Promise<Models.Provider>; + /** + * Get a provider by its unique ID. + * + * + * @param {string} providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getProvider(providerId: string): Promise<Models.Provider>; + getProvider( + paramsOrFirst: { providerId: string } | string + ): Promise<Models.Provider> { + let params: { providerId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string }; + } else { + params = { + providerId: paramsOrFirst as string + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + 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 provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteProvider(params: { providerId: string }): Promise<{}>; + /** + * Delete a provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteProvider(providerId: string): Promise<{}>; + deleteProvider( + paramsOrFirst: { providerId: string } | string + ): Promise<{}> { + let params: { providerId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string }; + } else { + params = { + providerId: paramsOrFirst as string + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the provider activity logs listed by its unique ID. + * + * @param {string} params.providerId - Provider 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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the provider activity logs listed by its unique ID. + * + * @param {string} providerId - Provider 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). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listProviderLogs( + paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { providerId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, queries?: string[], total?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const providerId = params.providerId; + const queries = params.queries; + const total = params.total; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}/logs'.replace('{providerId}', providerId); + 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 the subscriber activity logs listed by its unique ID. + * + * @param {string} params.subscriberId - Subscriber 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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the subscriber activity logs listed by its unique ID. + * + * @param {string} subscriberId - Subscriber 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). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listSubscriberLogs( + paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { subscriberId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[], total?: boolean }; + } else { + params = { + subscriberId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const subscriberId = params.subscriberId; + const queries = params.queries; + const total = params.total; + + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + + const apiPath = '/messaging/subscribers/{subscriberId}/logs'.replace('{subscriberId}', subscriberId); + 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 a list of all topics from the current Appwrite project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TopicList>} + */ + listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; + /** + * Get a list of all topics from the current Appwrite project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TopicList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTopics(queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; + listTopics( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.TopicList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/topics'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new topic. + * + * @param {string} params.topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. + * @param {string} params.name - Topic Name. + * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; + /** + * Create a new topic. + * + * @param {string} topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. + * @param {string} name - Topic Name. + * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTopic(topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; + createTopic( + paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Topic> { + let params: { topicId: string, name: string, subscribe?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, name: string, subscribe?: string[] }; + } else { + params = { + topicId: paramsOrFirst as string, + name: rest[0] as string, + subscribe: rest[1] as string[] + }; + } + + const topicId = params.topicId; + const name = params.name; + const subscribe = params.subscribe; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/topics'; + const payload: Payload = {}; + if (typeof topicId !== 'undefined') { + payload['topicId'] = topicId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof subscribe !== 'undefined') { + payload['subscribe'] = subscribe; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a topic by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + getTopic(params: { topicId: string }): Promise<Models.Topic>; + /** + * Get a topic by its unique ID. + * + * + * @param {string} topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTopic(topicId: string): Promise<Models.Topic>; + getTopic( + paramsOrFirst: { topicId: string } | string + ): Promise<Models.Topic> { + let params: { topicId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string }; + } else { + params = { + topicId: paramsOrFirst as string + }; + } + + const topicId = params.topicId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a topic by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. + * @param {string} params.name - Topic Name. + * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; + /** + * Update a topic by its unique ID. + * + * + * @param {string} topicId - Topic ID. + * @param {string} name - Topic Name. + * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; + updateTopic( + paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Topic> { + let params: { topicId: string, name?: string, subscribe?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, name?: string, subscribe?: string[] }; + } else { + params = { + topicId: paramsOrFirst as string, + name: rest[0] as string, + subscribe: rest[1] as string[] + }; + } + + const topicId = params.topicId; + const name = params.name; + const subscribe = params.subscribe; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof subscribe !== 'undefined') { + payload['subscribe'] = subscribe; + } + 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 topic by its unique ID. + * + * @param {string} params.topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTopic(params: { topicId: string }): Promise<{}>; + /** + * Delete a topic by its unique ID. + * + * @param {string} topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTopic(topicId: string): Promise<{}>; + deleteTopic( + paramsOrFirst: { topicId: string } | string + ): Promise<{}> { + let params: { topicId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string }; + } else { + params = { + topicId: paramsOrFirst as string + }; + } + + const topicId = params.topicId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the topic activity logs listed by its unique ID. + * + * @param {string} params.topicId - Topic 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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the topic activity logs listed by its unique ID. + * + * @param {string} topicId - Topic 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). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listTopicLogs( + paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { topicId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], total?: boolean }; + } else { + params = { + topicId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const topicId = params.topicId; + const queries = params.queries; + const total = params.total; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}/logs'.replace('{topicId}', topicId); + 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 a list of all subscribers from the current Appwrite project. + * + * @param {string} params.topicId - Topic ID. The topic ID subscribed to. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SubscriberList>} + */ + listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; + /** + * Get a list of all subscribers from the current Appwrite project. + * + * @param {string} topicId - Topic ID. The topic ID subscribed to. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SubscriberList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; + listSubscribers( + paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.SubscriberList> { + let params: { topicId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + topicId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const topicId = params.topicId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** * Create a new subscriber. * @@ -83,6 +5071,67 @@ export class Messaging { ); } + /** + * Get a subscriber by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. The topic ID subscribed to. + * @param {string} params.subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + */ + getSubscriber(params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; + /** + * Get a subscriber by its unique ID. + * + * + * @param {string} topicId - Topic ID. The topic ID subscribed to. + * @param {string} subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSubscriber(topicId: string, subscriberId: string): Promise<Models.Subscriber>; + getSubscriber( + paramsOrFirst: { topicId: string, subscriberId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Subscriber> { + let params: { topicId: string, subscriberId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; + } else { + params = { + topicId: paramsOrFirst as string, + subscriberId: rest[0] as string + }; + } + + const topicId = params.topicId; + const subscriberId = params.subscriberId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); + 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 subscriber by its unique ID. * diff --git a/src/services/project.ts b/src/services/project.ts new file mode 100644 index 00000000..08f00012 --- /dev/null +++ b/src/services/project.ts @@ -0,0 +1,6436 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { AuthMethod } from '../enums/auth-method'; +import { Scopes } from '../enums/scopes'; +import { Prompt } from '../enums/prompt'; +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'; + +export class Project { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Delete a project. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(): Promise<{}> { + + const apiPath = '/project'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * + * @param {AuthMethod} 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<Models.Project>} + */ + updateAuthMethod(params: { methodId: AuthMethod, enabled: boolean }): Promise<Models.Project>; + /** + * 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 {boolean} enabled - Auth method status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAuthMethod(methodId: AuthMethod, enabled: boolean): Promise<Models.Project>; + updateAuthMethod( + paramsOrFirst: { methodId: AuthMethod, enabled: boolean } | AuthMethod, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { methodId: AuthMethod, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { methodId: AuthMethod, enabled: boolean }; + } else { + params = { + methodId: paramsOrFirst as AuthMethod, + enabled: rest[0] as boolean + }; + } + + const methodId = params.methodId; + const enabled = params.enabled; + + if (typeof methodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "methodId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all API keys from the current project. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + */ + listKeys(params?: { queries?: string[], total?: boolean }): Promise<Models.KeyList>; + /** + * Get a list of all API keys from the current project. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listKeys(queries?: string[], total?: boolean): Promise<Models.KeyList>; + listKeys( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.KeyList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/keys'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key instead. + * + * @param {string} params.keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + createKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>; + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key instead. + * + * @param {string} keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Key name. Max length: 128 chars. + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>; + createKey( + paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, + ...rest: [(string)?, (Scopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as Scopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys'; + const payload: Payload = {}; + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.EphemeralKey>} + */ + createEphemeralKey(params: { scopes: Scopes[], duration: number }): Promise<Models.EphemeralKey>; + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.EphemeralKey>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEphemeralKey(scopes: Scopes[], duration: number): Promise<Models.EphemeralKey>; + createEphemeralKey( + paramsOrFirst: { scopes: Scopes[], duration: number } | Scopes[], + ...rest: [(number)?] + ): Promise<Models.EphemeralKey> { + let params: { scopes: Scopes[], duration: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { scopes: Scopes[], duration: number }; + } else { + params = { + scopes: paramsOrFirst as Scopes[], + duration: rest[0] as number + }; + } + + const scopes = params.scopes; + const duration = params.duration; + + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + if (typeof duration === 'undefined') { + throw new AppwriteException('Missing required parameter: "duration"'); + } + + const apiPath = '/project/keys/ephemeral'; + const payload: Payload = {}; + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a key by its unique ID. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + getKey(params: { keyId: string }): Promise<Models.Key>; + /** + * Get a key by its unique ID. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getKey(keyId: string): Promise<Models.Key>; + getKey( + paramsOrFirst: { keyId: string } | string + ): Promise<Models.Key> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} params.keyId - Key ID. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>; + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} keyId - Key ID. + * @param {string} name - Key name. Max length: 128 chars. + * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>; + updateKey( + paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, + ...rest: [(string)?, (Scopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as Scopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteKey(params: { keyId: string }): Promise<{}>; + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteKey(keyId: string): Promise<{}>; + deleteKey( + paramsOrFirst: { keyId: string } | string + ): Promise<{}> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateLabels(params: { labels: string[] }): Promise<Models.Project>; + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels(labels: string[]): Promise<Models.Project>; + updateLabels( + paramsOrFirst: { labels: string[] } | string[] + ): Promise<Models.Project> { + let params: { labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { labels: string[] }; + } else { + params = { + labels: paramsOrFirst as string[] + }; + } + + const labels = params.labels; + + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/project/labels'; + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumberList>} + */ + listMockPhones(params?: { queries?: string[], total?: boolean }): Promise<Models.MockNumberList>; + /** + * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumberList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMockPhones(queries?: string[], total?: boolean): Promise<Models.MockNumberList>; + listMockPhones( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.MockNumberList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/mock-phones'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} params.number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + createMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; + /** + * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMockPhone(number: string, otp: string): Promise<Models.MockNumber>; + createMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.MockNumber> { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones'; + const payload: Payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + getMockPhone(params: { number: string }): Promise<Models.MockNumber>; + /** + * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMockPhone(number: string): Promise<Models.MockNumber>; + getMockPhone( + paramsOrFirst: { number: string } | string + ): Promise<Models.MockNumber> { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + updateMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; + /** + * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMockPhone(number: string, otp: string): Promise<Models.MockNumber>; + updateMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.MockNumber> { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMockPhone(params: { number: string }): Promise<{}>; + /** + * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMockPhone(number: string): Promise<{}>; + deleteMockPhone( + paramsOrFirst: { number: string } | string + ): Promise<{}> { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2ProviderList>} + */ + listOAuth2Providers(params?: { queries?: string[], total?: boolean }): Promise<Models.OAuth2ProviderList>; + /** + * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2ProviderList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOAuth2Providers(queries?: string[], total?: boolean): Promise<Models.OAuth2ProviderList>; + listOAuth2Providers( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.OAuth2ProviderList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/oauth2'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Amazon configuration. + * + * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Amazon>} + */ + updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Amazon>; + /** + * Update the project OAuth2 Amazon configuration. + * + * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Amazon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Amazon>; + updateOAuth2Amazon( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Amazon> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/amazon'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Apple configuration. + * + * @param {string} params.serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} params.keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} params.teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} params.p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Apple>} + */ + updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise<Models.OAuth2Apple>; + /** + * Update the project OAuth2 Apple configuration. + * + * @param {string} serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Apple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise<Models.OAuth2Apple>; + updateOAuth2Apple( + paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Apple> { + let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + } else { + params = { + serviceId: paramsOrFirst as string, + keyId: rest[0] as string, + teamId: rest[1] as string, + p8File: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const serviceId = params.serviceId; + const keyId = params.keyId; + const teamId = params.teamId; + const p8File = params.p8File; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/apple'; + const payload: Payload = {}; + if (typeof serviceId !== 'undefined') { + payload['serviceId'] = serviceId; + } + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof p8File !== 'undefined') { + payload['p8File'] = p8File; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Auth0>} + */ + updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Auth0>; + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Auth0>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Auth0>; + updateOAuth2Auth0( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Auth0> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/auth0'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Authentik configuration. + * + * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Authentik>} + */ + updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Authentik>; + /** + * Update the project OAuth2 Authentik configuration. + * + * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Authentik>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Authentik>; + updateOAuth2Authentik( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Authentik> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/authentik'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Autodesk>} + */ + updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Autodesk>; + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Autodesk>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Autodesk>; + updateOAuth2Autodesk( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Autodesk> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/autodesk'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitbucket>} + */ + updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitbucket>; + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitbucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise<Models.OAuth2Bitbucket>; + updateOAuth2Bitbucket( + paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Bitbucket> { + let params: { key?: string, secret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; + } else { + params = { + key: paramsOrFirst as string, + secret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const key = params.key; + const secret = params.secret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitbucket'; + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitly>} + */ + updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitly>; + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitly>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Bitly>; + updateOAuth2Bitly( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Bitly> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitly'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Box configuration. + * + * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Box>} + */ + updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Box>; + /** + * Update the project OAuth2 Box configuration. + * + * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Box>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Box>; + updateOAuth2Box( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Box> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/box'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dailymotion>} + */ + updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dailymotion>; + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dailymotion>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dailymotion>; + updateOAuth2Dailymotion( + paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Dailymotion> { + let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; + } else { + params = { + apiKey: paramsOrFirst as string, + apiSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dailymotion'; + const payload: Payload = {}; + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Discord configuration. + * + * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Discord>} + */ + updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Discord>; + /** + * Update the project OAuth2 Discord configuration. + * + * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Discord>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Discord>; + updateOAuth2Discord( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Discord> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/discord'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Disqus configuration. + * + * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Disqus>} + */ + updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Disqus>; + /** + * Update the project OAuth2 Disqus configuration. + * + * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Disqus>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Disqus>; + updateOAuth2Disqus( + paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Disqus> { + let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + publicKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const publicKey = params.publicKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/disqus'; + const payload: Payload = {}; + if (typeof publicKey !== 'undefined') { + payload['publicKey'] = publicKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dropbox>} + */ + updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dropbox>; + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dropbox>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dropbox>; + updateOAuth2Dropbox( + paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Dropbox> { + let params: { appKey?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appKey: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appKey = params.appKey; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dropbox'; + const payload: Payload = {}; + if (typeof appKey !== 'undefined') { + payload['appKey'] = appKey; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Etsy configuration. + * + * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Etsy>} + */ + updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Etsy>; + /** + * Update the project OAuth2 Etsy configuration. + * + * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Etsy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise<Models.OAuth2Etsy>; + updateOAuth2Etsy( + paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Etsy> { + let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; + } else { + params = { + keyString: paramsOrFirst as string, + sharedSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const keyString = params.keyString; + const sharedSecret = params.sharedSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/etsy'; + const payload: Payload = {}; + if (typeof keyString !== 'undefined') { + payload['keyString'] = keyString; + } + if (typeof sharedSecret !== 'undefined') { + payload['sharedSecret'] = sharedSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Facebook configuration. + * + * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Facebook>} + */ + updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Facebook>; + /** + * Update the project OAuth2 Facebook configuration. + * + * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Facebook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Facebook>; + updateOAuth2Facebook( + paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Facebook> { + let params: { appId?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appId = params.appId; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/facebook'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Figma configuration. + * + * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Figma>} + */ + updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Figma>; + /** + * Update the project OAuth2 Figma configuration. + * + * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Figma>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Figma>; + updateOAuth2Figma( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Figma> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/figma'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2FusionAuth>} + */ + updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2FusionAuth>; + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2FusionAuth>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2FusionAuth>; + updateOAuth2FusionAuth( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2FusionAuth> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/fusionauth'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 GitHub configuration. + * + * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github>} + */ + updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Github>; + /** + * Update the project OAuth2 GitHub configuration. + * + * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Github>; + updateOAuth2GitHub( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Github> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/github'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Gitlab>} + */ + updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Gitlab>; + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Gitlab>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Gitlab>; + updateOAuth2Gitlab( + paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Gitlab> { + let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + secret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const secret = params.secret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/gitlab'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Google configuration. + * + * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {Prompt[]} 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<Models.OAuth2Google>} + */ + updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }): Promise<Models.OAuth2Google>; + /** + * Update the project OAuth2 Google configuration. + * + * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {Prompt[]} 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<Models.OAuth2Google>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Google(clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean): Promise<Models.OAuth2Google>; + updateOAuth2Google( + paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean } | string, + ...rest: [(string)?, (Prompt[])?, (boolean)?] + ): Promise<Models.OAuth2Google> { + let params: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + prompt: rest[1] as Prompt[], + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const prompt = params.prompt; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/google'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Keycloak>} + */ + updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise<Models.OAuth2Keycloak>; + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Keycloak>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise<Models.OAuth2Keycloak>; + updateOAuth2Keycloak( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Keycloak> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + realmName: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const realmName = params.realmName; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/keycloak'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof realmName !== 'undefined') { + payload['realmName'] = realmName; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Kick configuration. + * + * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Kick>} + */ + updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Kick>; + /** + * Update the project OAuth2 Kick configuration. + * + * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Kick>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Kick>; + updateOAuth2Kick( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Kick> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/kick'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Linkedin>} + */ + updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Linkedin>; + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Linkedin>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Linkedin>; + updateOAuth2Linkedin( + paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Linkedin> { + let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + primaryClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const primaryClientSecret = params.primaryClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/linkedin'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof primaryClientSecret !== 'undefined') { + payload['primaryClientSecret'] = primaryClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Microsoft>} + */ + updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise<Models.OAuth2Microsoft>; + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Microsoft>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise<Models.OAuth2Microsoft>; + updateOAuth2Microsoft( + paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Microsoft> { + let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + applicationSecret: rest[0] as string, + tenant: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const applicationSecret = params.applicationSecret; + const tenant = params.tenant; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/microsoft'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof applicationSecret !== 'undefined') { + payload['applicationSecret'] = applicationSecret; + } + if (typeof tenant !== 'undefined') { + payload['tenant'] = tenant; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Notion configuration. + * + * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Notion>} + */ + updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Notion>; + /** + * Update the project OAuth2 Notion configuration. + * + * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Notion>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Notion>; + updateOAuth2Notion( + paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Notion> { + let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauthClientId: paramsOrFirst as string, + oauthClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauthClientId = params.oauthClientId; + const oauthClientSecret = params.oauthClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/notion'; + const payload: Payload = {}; + if (typeof oauthClientId !== 'undefined') { + payload['oauthClientId'] = oauthClientId; + } + if (typeof oauthClientSecret !== 'undefined') { + payload['oauthClientSecret'] = oauthClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Oidc configuration. + * + * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} params.userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Oidc>} + */ + updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise<Models.OAuth2Oidc>; + /** + * Update the project OAuth2 Oidc configuration. + * + * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Oidc>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise<Models.OAuth2Oidc>; + updateOAuth2Oidc( + paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Oidc> { + let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + wellKnownURL: rest[1] as string, + authorizationURL: rest[2] as string, + tokenURL: rest[3] as string, + userInfoURL: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const wellKnownURL = params.wellKnownURL; + const authorizationURL = params.authorizationURL; + const tokenURL = params.tokenURL; + const userInfoURL = params.userInfoURL; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/oidc'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof wellKnownURL !== 'undefined') { + payload['wellKnownURL'] = wellKnownURL; + } + if (typeof authorizationURL !== 'undefined') { + payload['authorizationURL'] = authorizationURL; + } + if (typeof tokenURL !== 'undefined') { + payload['tokenURL'] = tokenURL; + } + if (typeof userInfoURL !== 'undefined') { + payload['userInfoURL'] = userInfoURL; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Okta configuration. + * + * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Okta>} + */ + updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise<Models.OAuth2Okta>; + /** + * Update the project OAuth2 Okta configuration. + * + * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Okta>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise<Models.OAuth2Okta>; + updateOAuth2Okta( + paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Okta> { + let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + domain: rest[1] as string, + authorizationServerId: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const domain = params.domain; + const authorizationServerId = params.authorizationServerId; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/okta'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof authorizationServerId !== 'undefined') { + payload['authorizationServerId'] = authorizationServerId; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Paypal configuration. + * + * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + */ + updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; + /** + * Update the project OAuth2 Paypal configuration. + * + * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; + updateOAuth2Paypal( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Paypal> { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypal'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + */ + updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; + updateOAuth2PaypalSandbox( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Paypal> { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypalSandbox'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Podio configuration. + * + * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Podio>} + */ + updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Podio>; + /** + * Update the project OAuth2 Podio configuration. + * + * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Podio>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Podio>; + updateOAuth2Podio( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Podio> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/podio'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Salesforce>} + */ + updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Salesforce>; + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Salesforce>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise<Models.OAuth2Salesforce>; + updateOAuth2Salesforce( + paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Salesforce> { + let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + customerSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const customerSecret = params.customerSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/salesforce'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof customerSecret !== 'undefined') { + payload['customerSecret'] = customerSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Slack configuration. + * + * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Slack>} + */ + updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Slack>; + /** + * Update the project OAuth2 Slack configuration. + * + * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Slack>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Slack>; + updateOAuth2Slack( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Slack> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/slack'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Spotify configuration. + * + * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Spotify>} + */ + updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Spotify>; + /** + * Update the project OAuth2 Spotify configuration. + * + * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Spotify>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Spotify>; + updateOAuth2Spotify( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Spotify> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/spotify'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Stripe configuration. + * + * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Stripe>} + */ + updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Stripe>; + /** + * Update the project OAuth2 Stripe configuration. + * + * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Stripe>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise<Models.OAuth2Stripe>; + updateOAuth2Stripe( + paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Stripe> { + let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + apiSecretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const apiSecretKey = params.apiSecretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/stripe'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof apiSecretKey !== 'undefined') { + payload['apiSecretKey'] = apiSecretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + */ + updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; + updateOAuth2Tradeshift( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Tradeshift> { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshift'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + */ + updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; + updateOAuth2TradeshiftSandbox( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Tradeshift> { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshiftBox'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Twitch configuration. + * + * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Twitch>} + */ + updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Twitch>; + /** + * Update the project OAuth2 Twitch configuration. + * + * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Twitch>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Twitch>; + updateOAuth2Twitch( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Twitch> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/twitch'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 WordPress configuration. + * + * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2WordPress>} + */ + updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2WordPress>; + /** + * Update the project OAuth2 WordPress configuration. + * + * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2WordPress>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2WordPress>; + updateOAuth2WordPress( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2WordPress> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/wordpress'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 X configuration. + * + * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2X>} + */ + updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2X>; + /** + * Update the project OAuth2 X configuration. + * + * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2X>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2X>; + updateOAuth2X( + paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2X> { + let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/x'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yahoo>} + */ + updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yahoo>; + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yahoo>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yahoo>; + updateOAuth2Yahoo( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Yahoo> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/yahoo'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 Yandex configuration. + * + * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yandex>} + */ + updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yandex>; + /** + * Update the project OAuth2 Yandex configuration. + * + * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yandex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yandex>; + updateOAuth2Yandex( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Yandex> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/yandex'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * 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: 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<Models.OAuth2Zoho>} + */ + updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoho>; + /** + * 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: 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<Models.OAuth2Zoho>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoho>; + updateOAuth2Zoho( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Zoho> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/zoho'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the project OAuth2 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: 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<Models.OAuth2Zoom>} + */ + updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoom>; + /** + * 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: 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<Models.OAuth2Zoom>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoom>; + updateOAuth2Zoom( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Zoom> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/zoom'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} + */ + getOAuth2Provider(params: { providerId: OAuthProvider }): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getOAuth2Provider(providerId: OAuthProvider): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; + getOAuth2Provider( + paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider + ): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft> { + let params: { providerId: OAuthProvider }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; + } else { + params = { + providerId: paramsOrFirst as OAuthProvider + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); + 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 + ); + } + + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformList>} + */ + listPlatforms(params?: { queries?: string[], total?: boolean }): Promise<Models.PlatformList>; + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPlatforms(queries?: string[], total?: boolean): Promise<Models.PlatformList>; + listPlatforms( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.PlatformList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/platforms'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + */ + createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; + createAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformAndroid> { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + */ + updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; + updateAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformAndroid> { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + */ + createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; + createApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformApple> { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + */ + updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; + updateApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformApple> { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + */ + createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; + createLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformLinux> { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + */ + updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; + updateLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformLinux> { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + */ + createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; + createWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWeb> { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + */ + updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; + updateWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWeb> { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + */ + createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; + createWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWindows> { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + */ + updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; + updateWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWindows> { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} + */ + getPlatform(params: { platformId: string }): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPlatform(platformId: string): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; + getPlatform( + paramsOrFirst: { platformId: string } | string + ): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux> { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePlatform(params: { platformId: string }): Promise<{}>; + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePlatform(platformId: string): Promise<{}>; + deletePlatform( + paramsOrFirst: { platformId: string } | string + ): Promise<{}> { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all project policies and their current configuration. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyList>} + */ + listPolicies(params?: { queries?: string[], total?: boolean }): Promise<Models.PolicyList>; + /** + * Get a list of all project policies and their current configuration. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPolicies(queries?: string[], total?: boolean): Promise<Models.PolicyList>; + listPolicies( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.PolicyList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/policies'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Configures if email aliases 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 email aliases during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateDenyCanonicalEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Configures if email aliases 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 email aliases during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyCanonicalEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyCanonicalEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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-canonical-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<Models.Project>} + */ + updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * 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<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyDisposableEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyDisposableEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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<Models.Project>} + */ + updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * 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<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyFreeEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyFreeEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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.. + * + * @param {boolean} params.userId - Set to true if you want make user ID visible to all team members, or false to hide it. + * @param {boolean} params.userEmail - Set to true if you want make user email visible to all team members, or false to hide it. + * @param {boolean} params.userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. + * @param {boolean} params.userName - Set to true if you want make user name visible to all team members, or false to hide it. + * @param {boolean} params.userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }): Promise<Models.Project>; + /** + * 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.. + * + * @param {boolean} userId - Set to true if you want make user ID visible to all team members, or false to hide it. + * @param {boolean} userEmail - Set to true if you want make user email visible to all team members, or false to hide it. + * @param {boolean} userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. + * @param {boolean} userName - Set to true if you want make user name visible to all team members, or false to hide it. + * @param {boolean} userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean): Promise<Models.Project>; + updateMembershipPrivacyPolicy( + paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean } | boolean, + ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Project> { + let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + } else { + params = { + userId: paramsOrFirst as boolean, + userEmail: rest[0] as boolean, + userPhone: rest[1] as boolean, + userName: rest[2] as boolean, + userMFA: rest[3] as boolean + }; + } + + const userId = params.userId; + const userEmail = params.userEmail; + const userPhone = params.userPhone; + const userName = params.userName; + const userMFA = params.userMFA; + + + const apiPath = '/project/policies/membership-privacy'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof userEmail !== 'undefined') { + payload['userEmail'] = userEmail; + } + if (typeof userPhone !== 'undefined') { + payload['userPhone'] = userPhone; + } + if (typeof userName !== 'undefined') { + payload['userName'] = userName; + } + if (typeof userMFA !== 'undefined') { + payload['userMFA'] = userMFA; + } + 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 new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. + * + * @param {boolean} params.enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordDictionaryPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. + * + * @param {boolean} enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordDictionaryPolicy(enabled: boolean): Promise<Models.Project>; + updatePasswordDictionaryPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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/password-dictionary'; + 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 + ); + } + + /** + * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + * + * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. + * + * @param {number} params.total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordHistoryPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + * + * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. + * + * @param {number} total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordHistoryPolicy(total?: number): Promise<Models.Project>; + updatePasswordHistoryPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/password-history'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + 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 password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. + * + * @param {boolean} params.enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordPersonalDataPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. + * + * @param {boolean} enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordPersonalDataPolicy(enabled: boolean): Promise<Models.Project>; + updatePasswordPersonalDataPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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/password-personal-data'; + 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 email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. + * + * @param {boolean} params.enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionAlertPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. + * + * @param {boolean} enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionAlertPolicy(enabled: boolean): Promise<Models.Project>; + updateSessionAlertPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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/session-alert'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update maximum duration how long sessions created within a project should stay active for. + * + * @param {number} params.duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionDurationPolicy(params: { duration: number }): Promise<Models.Project>; + /** + * Update maximum duration how long sessions created within a project should stay active for. + * + * @param {number} duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionDurationPolicy(duration: number): Promise<Models.Project>; + updateSessionDurationPolicy( + paramsOrFirst: { duration: number } | number + ): Promise<Models.Project> { + let params: { duration: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { duration: number }; + } else { + params = { + duration: paramsOrFirst as number + }; + } + + const duration = params.duration; + + if (typeof duration === 'undefined') { + throw new AppwriteException('Missing required parameter: "duration"'); + } + + const apiPath = '/project/policies/session-duration'; + const payload: Payload = {}; + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. + * + * @param {boolean} params.enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionInvalidationPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. + * + * @param {boolean} enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionInvalidationPolicy(enabled: boolean): Promise<Models.Project>; + updateSessionInvalidationPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + 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/session-invalidation'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. + * + * @param {number} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionLimitPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. + * + * @param {number} total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionLimitPolicy(total?: number): Promise<Models.Project>; + updateSessionLimitPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/session-limit'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. + * + * @param {number} params.total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateUserLimitPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. + * + * @param {number} total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUserLimitPolicy(total?: number): Promise<Models.Project>; + updateUserLimitPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/user-limit'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a 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. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + */ + getPolicy(params: { policyId: ProjectPolicy }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPolicy(policyId: ProjectPolicy): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + getPolicy( + paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy + ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy> { + let params: { policyId: ProjectPolicy }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; + } else { + params = { + policyId: paramsOrFirst as ProjectPolicy + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * + * @param {ProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {boolean} params.enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateProtocol(params: { protocolId: ProtocolId, enabled: boolean }): Promise<Models.Project>; + /** + * 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 {boolean} enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateProtocol(protocolId: ProtocolId, enabled: boolean): Promise<Models.Project>; + updateProtocol( + paramsOrFirst: { protocolId: ProtocolId, enabled: boolean } | ProtocolId, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { protocolId: ProtocolId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { protocolId: ProtocolId, enabled: boolean }; + } else { + params = { + protocolId: paramsOrFirst as ProtocolId, + enabled: rest[0] as boolean + }; + } + + const protocolId = params.protocolId; + const enabled = params.enabled; + + if (typeof protocolId === 'undefined') { + throw new AppwriteException('Missing required parameter: "protocolId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', protocolId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update 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 {boolean} params.enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateService(params: { serviceId: ServiceId, enabled: boolean }): Promise<Models.Project>; + /** + * 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 {boolean} enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateService(serviceId: ServiceId, enabled: boolean): Promise<Models.Project>; + updateService( + paramsOrFirst: { serviceId: ServiceId, enabled: boolean } | ServiceId, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { serviceId: ServiceId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId: ServiceId, enabled: boolean }; + } else { + params = { + serviceId: paramsOrFirst as ServiceId, + enabled: rest[0] as boolean + }; + } + + const serviceId = params.serviceId; + const enabled = params.enabled; + + if (typeof serviceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "serviceId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', serviceId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * 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. + * + * @param {string} params.host - SMTP server hostname (domain) + * @param {number} params.port - SMTP server port + * @param {string} params.username - SMTP server username. Leave empty for no authorization. + * @param {string} params.password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). + * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. + * @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 {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<Models.Project>} + */ + updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean }): Promise<Models.Project>; + /** + * 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. + * + * @param {string} host - SMTP server hostname (domain) + * @param {number} port - SMTP server port + * @param {string} username - SMTP server username. Leave empty for no authorization. + * @param {string} password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). + * @param {string} senderEmail - Email address shown in inbox as the sender of the email. + * @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 {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<Models.Project>} + * @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<Models.Project>; + 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)?] + ): Promise<Models.Project> { + let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, 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 }; + } else { + params = { + host: paramsOrFirst as string, + port: rest[0] as number, + username: rest[1] as string, + password: rest[2] as string, + senderEmail: rest[3] as string, + senderName: rest[4] as string, + replyToEmail: rest[5] as string, + replyToName: rest[6] as string, + secure: rest[7] as Secure, + enabled: rest[8] as boolean + }; + } + + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const senderEmail = params.senderEmail; + const senderName = params.senderName; + const replyToEmail = params.replyToEmail; + const replyToName = params.replyToName; + const secure = params.secure; + const enabled = params.enabled; + + + const apiPath = '/project/smtp'; + const payload: Payload = {}; + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof senderEmail !== 'undefined') { + payload['senderEmail'] = senderEmail; + } + if (typeof senderName !== 'undefined') { + payload['senderName'] = senderName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof secure !== 'undefined') { + payload['secure'] = secure; + } + 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 + ); + } + + /** + * Send a test email to verify SMTP configuration. + * + * @param {string[]} params.emails - Array of emails to send test email to. Maximum of 10 emails are allowed. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + createSMTPTest(params: { emails: string[] }): Promise<{}>; + /** + * Send a test email to verify SMTP configuration. + * + * @param {string[]} emails - Array of emails to send test email to. Maximum of 10 emails are allowed. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMTPTest(emails: string[]): Promise<{}>; + createSMTPTest( + paramsOrFirst: { emails: string[] } | string[] + ): Promise<{}> { + let params: { emails: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { emails: string[] }; + } else { + params = { + emails: paramsOrFirst as string[] + }; + } + + const emails = params.emails; + + if (typeof emails === 'undefined') { + throw new AppwriteException('Missing required parameter: "emails"'); + } + + const apiPath = '/project/smtp/tests'; + const payload: Payload = {}; + if (typeof emails !== 'undefined') { + payload['emails'] = emails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplateList>} + */ + listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise<Models.EmailTemplateList>; + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplateList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEmailTemplates(queries?: string[], total?: boolean): Promise<Models.EmailTemplateList>; + listEmailTemplates( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.EmailTemplateList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/templates/email'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. + * + * @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 {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. + * @param {string} params.senderEmail - Email of the sender. + * @param {string} params.replyToEmail - Reply to email. + * @param {string} params.replyToName - Reply to name. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + */ + updateEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise<Models.EmailTemplate>; + /** + * 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 {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. + * @param {string} senderEmail - Email of the sender. + * @param {string} replyToEmail - Reply to email. + * @param {string} replyToName - Reply to name. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + * @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<Models.EmailTemplate>; + 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)?] + ): Promise<Models.EmailTemplate> { + let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, 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 }; + } else { + params = { + templateId: paramsOrFirst as EmailTemplateType, + locale: rest[0] as EmailTemplateLocale, + subject: rest[1] as string, + message: rest[2] as string, + senderName: rest[3] as string, + senderEmail: rest[4] as string, + replyToEmail: rest[5] as string, + replyToName: rest[6] as string + }; + } + + const templateId = params.templateId; + const locale = params.locale; + const subject = params.subject; + const message = params.message; + const senderName = params.senderName; + const senderEmail = params.senderEmail; + const replyToEmail = params.replyToEmail; + const replyToName = params.replyToName; + + if (typeof templateId === 'undefined') { + throw new AppwriteException('Missing required parameter: "templateId"'); + } + + const apiPath = '/project/templates/email'; + const payload: Payload = {}; + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof locale !== 'undefined') { + payload['locale'] = locale; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof message !== 'undefined') { + payload['message'] = message; + } + if (typeof senderName !== 'undefined') { + payload['senderName'] = senderName; + } + if (typeof senderEmail !== 'undefined') { + payload['senderEmail'] = senderEmail; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a 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. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + */ + getEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }): Promise<Models.EmailTemplate>; + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEmailTemplate(templateId: EmailTemplateType, locale?: EmailTemplateLocale): Promise<Models.EmailTemplate>; + getEmailTemplate( + paramsOrFirst: { templateId: EmailTemplateType, locale?: EmailTemplateLocale } | EmailTemplateType, + ...rest: [(EmailTemplateLocale)?] + ): Promise<Models.EmailTemplate> { + let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; + } else { + params = { + templateId: paramsOrFirst as EmailTemplateType, + locale: rest[0] as EmailTemplateLocale + }; + } + + const templateId = params.templateId; + const locale = params.locale; + + if (typeof templateId === 'undefined') { + throw new AppwriteException('Missing required parameter: "templateId"'); + } + + const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', templateId); + const payload: Payload = {}; + if (typeof locale !== 'undefined') { + payload['locale'] = locale; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all project environment variables. + * + * @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: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params?: { queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all project environment variables. + * + * @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: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listVariables(queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.VariableList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/variables'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. + * + * @param {string} params.variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. + * + * @param {string} variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { variableId: string, key: string, value: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string, key: string, value: string, secret?: boolean }; + } else { + params = { + variableId: paramsOrFirst as string, + key: rest[0] as string, + value: rest[1] as string, + secret: rest[2] as boolean + }; + } + + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); + } + + const apiPath = '/project/variables'; + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + getVariable(params: { variableId: string }): Promise<Models.Variable>; + /** + * Get a variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getVariable(variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { variableId: string } | string + ): Promise<Models.Variable> { + let params: { variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string }; + } else { + params = { + variableId: paramsOrFirst as string + }; + } + + const variableId = params.variableId; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + variableId: paramsOrFirst as string, + key: rest[0] as string, + value: rest[1] as string, + secret: rest[2] as boolean + }; + } + + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { variableId: string } | string + ): Promise<{}> { + let params: { variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string }; + } else { + params = { + variableId: paramsOrFirst as string + }; + } + + const variableId = params.variableId; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + 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/proxy.ts b/src/services/proxy.ts new file mode 100644 index 00000000..a5a86736 --- /dev/null +++ b/src/services/proxy.ts @@ -0,0 +1,541 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { StatusCode } from '../enums/status-code'; +import { ProxyResourceType } from '../enums/proxy-resource-type'; + +export class Proxy { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the proxy rules. 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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRuleList>} + */ + listRules(params?: { queries?: string[], total?: boolean }): Promise<Models.ProxyRuleList>; + /** + * Get a list of all the proxy rules. 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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRuleList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRules(queries?: string[], total?: boolean): Promise<Models.ProxyRuleList>; + listRules( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.ProxyRuleList> { + 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 = '/proxy/rules'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createAPIRule(params: { domain: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAPIRule(domain: string): Promise<Models.ProxyRule>; + createAPIRule( + paramsOrFirst: { domain: string } | string + ): Promise<Models.ProxyRule> { + let params: { domain: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string }; + } else { + params = { + domain: paramsOrFirst as string + }; + } + + const domain = params.domain; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + + const apiPath = '/proxy/rules/api'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.functionId - ID of function to be executed. + * @param {string} params.branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createFunctionRule(params: { domain: string, functionId: string, branch?: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} functionId - ID of function to be executed. + * @param {string} branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFunctionRule(domain: string, functionId: string, branch?: string): Promise<Models.ProxyRule>; + createFunctionRule( + paramsOrFirst: { domain: string, functionId: string, branch?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, functionId: string, branch?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, functionId: string, branch?: string }; + } else { + params = { + domain: paramsOrFirst as string, + functionId: rest[0] as string, + branch: rest[1] as string + }; + } + + const domain = params.domain; + const functionId = params.functionId; + const branch = params.branch; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/proxy/rules/function'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof functionId !== 'undefined') { + payload['functionId'] = functionId; + } + if (typeof branch !== 'undefined') { + payload['branch'] = branch; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new proxy rule for to redirect from custom domain to another domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.url - Target URL of redirection + * @param {StatusCode} params.statusCode - Status code of redirection + * @param {string} params.resourceId - ID of parent resource. + * @param {ProxyResourceType} params.resourceType - Type of parent resource. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for to redirect from custom domain to another domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} url - Target URL of redirection + * @param {StatusCode} statusCode - Status code of redirection + * @param {string} resourceId - ID of parent resource. + * @param {ProxyResourceType} resourceType - Type of parent resource. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise<Models.ProxyRule>; + createRedirectRule( + paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, + ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; + } else { + params = { + domain: paramsOrFirst as string, + url: rest[0] as string, + statusCode: rest[1] as StatusCode, + resourceId: rest[2] as string, + resourceType: rest[3] as ProxyResourceType + }; + } + + const domain = params.domain; + const url = params.url; + const statusCode = params.statusCode; + const resourceId = params.resourceId; + const resourceType = params.resourceType; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof statusCode === 'undefined') { + throw new AppwriteException('Missing required parameter: "statusCode"'); + } + if (typeof resourceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceId"'); + } + if (typeof resourceType === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceType"'); + } + + const apiPath = '/proxy/rules/redirect'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof statusCode !== 'undefined') { + payload['statusCode'] = statusCode; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof resourceType !== 'undefined') { + payload['resourceType'] = resourceType; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.siteId - ID of site to be executed. + * @param {string} params.branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createSiteRule(params: { domain: string, siteId: string, branch?: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} siteId - ID of site to be executed. + * @param {string} branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSiteRule(domain: string, siteId: string, branch?: string): Promise<Models.ProxyRule>; + createSiteRule( + paramsOrFirst: { domain: string, siteId: string, branch?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, siteId: string, branch?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, siteId: string, branch?: string }; + } else { + params = { + domain: paramsOrFirst as string, + siteId: rest[0] as string, + branch: rest[1] as string + }; + } + + const domain = params.domain; + const siteId = params.siteId; + const branch = params.branch; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/proxy/rules/site'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof siteId !== 'undefined') { + payload['siteId'] = siteId; + } + if (typeof branch !== 'undefined') { + payload['branch'] = branch; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a proxy rule by its unique ID. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + getRule(params: { ruleId: string }): Promise<Models.ProxyRule>; + /** + * Get a proxy rule by its unique ID. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRule(ruleId: string): Promise<Models.ProxyRule>; + getRule( + paramsOrFirst: { ruleId: string } | string + ): Promise<Models.ProxyRule> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + 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 proxy rule by its unique ID. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteRule(params: { ruleId: string }): Promise<{}>; + /** + * Delete a proxy rule by its unique ID. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteRule(ruleId: string): Promise<{}>; + deleteRule( + paramsOrFirst: { ruleId: string } | string + ): Promise<{}> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + 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 + ); + } + + /** + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + updateRuleStatus(params: { ruleId: string }): Promise<Models.ProxyRule>; + /** + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRuleStatus(ruleId: string): Promise<Models.ProxyRule>; + updateRuleStatus( + paramsOrFirst: { ruleId: string } | string + ): Promise<Models.ProxyRule> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', ruleId); + 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( + 'patch', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/sites.ts b/src/services/sites.ts new file mode 100644 index 00000000..fbad3468 --- /dev/null +++ b/src/services/sites.ts @@ -0,0 +1,1917 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { Framework } from '../enums/framework'; +import { BuildRuntime } from '../enums/build-runtime'; +import { Adapter } from '../enums/adapter'; +import { TemplateReferenceType } from '../enums/template-reference-type'; +import { VCSReferenceType } from '../enums/vcs-reference-type'; +import { DeploymentDownloadType } from '../enums/deployment-download-type'; + +export class Sites { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's sites. You can use the query params to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SiteList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.SiteList>; + /** + * Get a list of all the project's sites. You can use the query params to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SiteList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.SiteList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/sites'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new site. + * + * @param {string} params.siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Site name. Max length: 128 chars. + * @param {Framework} params.framework - Sites framework. + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} params.timeout - Maximum request time in seconds. + * @param {string} params.installCommand - Install Command. + * @param {string} params.buildCommand - Build Command. + * @param {string} params.startCommand - Custom start command. Leave empty to use default. + * @param {string} params.outputDirectory - Output Directory for site. + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.fallbackFile - Fallback file for single page application sites. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} params.providerBranch - Production branch for the repo linked to the site. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the site deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + /** + * Create a new site. + * + * @param {string} siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Site name. Max length: 128 chars. + * @param {Framework} framework - Sites framework. + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. + * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} timeout - Maximum request time in seconds. + * @param {string} installCommand - Install Command. + * @param {string} buildCommand - Build Command. + * @param {string} startCommand - Custom start command. Leave empty to use default. + * @param {string} outputDirectory - Output Directory for site. + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} fallbackFile - Fallback file for single page application sites. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} providerBranch - Production branch for the repo linked to the site. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string} buildSpecification - Build specification for the site deployments. + * @param {string} runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + create( + paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Site> { + let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + siteId: paramsOrFirst as string, + name: rest[0] as string, + framework: rest[1] as Framework, + buildRuntime: rest[2] as BuildRuntime, + enabled: rest[3] as boolean, + logging: rest[4] as boolean, + timeout: rest[5] as number, + installCommand: rest[6] as string, + buildCommand: rest[7] as string, + startCommand: rest[8] as string, + outputDirectory: rest[9] as string, + adapter: rest[10] as Adapter, + installationId: rest[11] as string, + fallbackFile: rest[12] as string, + providerRepositoryId: rest[13] as string, + providerBranch: rest[14] as string, + providerSilentMode: rest[15] as boolean, + providerRootDirectory: rest[16] as string, + buildSpecification: rest[17] as string, + runtimeSpecification: rest[18] as string, + deploymentRetention: rest[19] as number + }; + } + + const siteId = params.siteId; + const name = params.name; + const framework = params.framework; + const buildRuntime = params.buildRuntime; + const enabled = params.enabled; + const logging = params.logging; + const timeout = params.timeout; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const startCommand = params.startCommand; + const outputDirectory = params.outputDirectory; + const adapter = params.adapter; + const installationId = params.installationId; + const fallbackFile = params.fallbackFile; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof framework === 'undefined') { + throw new AppwriteException('Missing required parameter: "framework"'); + } + if (typeof buildRuntime === 'undefined') { + throw new AppwriteException('Missing required parameter: "buildRuntime"'); + } + + const apiPath = '/sites'; + const payload: Payload = {}; + if (typeof siteId !== 'undefined') { + payload['siteId'] = siteId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof framework !== 'undefined') { + payload['framework'] = framework; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof startCommand !== 'undefined') { + payload['startCommand'] = startCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof buildRuntime !== 'undefined') { + payload['buildRuntime'] = buildRuntime; + } + if (typeof adapter !== 'undefined') { + payload['adapter'] = adapter; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof fallbackFile !== 'undefined') { + payload['fallbackFile'] = fallbackFile; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all frameworks that are currently available on the server instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.FrameworkList>} + */ + listFrameworks(): Promise<Models.FrameworkList> { + + const apiPath = '/sites/frameworks'; + 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 + ); + } + + /** + * List allowed site specifications for this instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.SpecificationList>} + */ + listSpecifications(): Promise<Models.SpecificationList> { + + const apiPath = '/sites/specifications'; + 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 + ); + } + + /** + * Get a site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + get(params: { siteId: string }): Promise<Models.Site>; + /** + * Get a site by its unique ID. + * + * @param {string} siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(siteId: string): Promise<Models.Site>; + get( + paramsOrFirst: { siteId: string } | string + ): Promise<Models.Site> { + let params: { siteId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string }; + } else { + params = { + siteId: paramsOrFirst as string + }; + } + + const siteId = params.siteId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.name - Site name. Max length: 128 chars. + * @param {Framework} params.framework - Sites framework. + * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} params.timeout - Maximum request time in seconds. + * @param {string} params.installCommand - Install Command. + * @param {string} params.buildCommand - Build Command. + * @param {string} params.startCommand - Custom start command. Leave empty to use default. + * @param {string} params.outputDirectory - Output Directory for site. + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} params.fallbackFile - Fallback file for single page application sites. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} params.providerBranch - Production branch for the repo linked to the site. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the site deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + /** + * Update site by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} name - Site name. Max length: 128 chars. + * @param {Framework} framework - Sites framework. + * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} timeout - Maximum request time in seconds. + * @param {string} installCommand - Install Command. + * @param {string} buildCommand - Build Command. + * @param {string} startCommand - Custom start command. Leave empty to use default. + * @param {string} outputDirectory - Output Directory for site. + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} fallbackFile - Fallback file for single page application sites. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} providerBranch - Production branch for the repo linked to the site. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string} buildSpecification - Build specification for the site deployments. + * @param {string} runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + update( + paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Site> { + let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + siteId: paramsOrFirst as string, + name: rest[0] as string, + framework: rest[1] as Framework, + enabled: rest[2] as boolean, + logging: rest[3] as boolean, + timeout: rest[4] as number, + installCommand: rest[5] as string, + buildCommand: rest[6] as string, + startCommand: rest[7] as string, + outputDirectory: rest[8] as string, + buildRuntime: rest[9] as BuildRuntime, + adapter: rest[10] as Adapter, + fallbackFile: rest[11] as string, + installationId: rest[12] as string, + providerRepositoryId: rest[13] as string, + providerBranch: rest[14] as string, + providerSilentMode: rest[15] as boolean, + providerRootDirectory: rest[16] as string, + buildSpecification: rest[17] as string, + runtimeSpecification: rest[18] as string, + deploymentRetention: rest[19] as number + }; + } + + const siteId = params.siteId; + const name = params.name; + const framework = params.framework; + const enabled = params.enabled; + const logging = params.logging; + const timeout = params.timeout; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const startCommand = params.startCommand; + const outputDirectory = params.outputDirectory; + const buildRuntime = params.buildRuntime; + const adapter = params.adapter; + const fallbackFile = params.fallbackFile; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof framework === 'undefined') { + throw new AppwriteException('Missing required parameter: "framework"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof framework !== 'undefined') { + payload['framework'] = framework; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof startCommand !== 'undefined') { + payload['startCommand'] = startCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof buildRuntime !== 'undefined') { + payload['buildRuntime'] = buildRuntime; + } + if (typeof adapter !== 'undefined') { + payload['adapter'] = adapter; + } + if (typeof fallbackFile !== 'undefined') { + payload['fallbackFile'] = fallbackFile; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { siteId: string }): Promise<{}>; + /** + * Delete a site by its unique ID. + * + * @param {string} siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(siteId: string): Promise<{}>; + delete( + paramsOrFirst: { siteId: string } | string + ): Promise<{}> { + let params: { siteId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string }; + } else { + params = { + siteId: paramsOrFirst as string + }; + } + + const siteId = params.siteId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Site>; + /** + * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSiteDeployment(siteId: string, deploymentId: string): Promise<Models.Site>; + updateSiteDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Site> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all the site's code deployments. You can use the query params to filter your results. + * + * @param {string} params.siteId - Site 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + */ + listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; + /** + * Get a list of all the site's code deployments. You can use the query params to filter your results. + * + * @param {string} siteId - Site 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; + listDeployments( + paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.DeploymentList> { + let params: { siteId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. + * + * @param {string} params.siteId - Site ID. + * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {string} params.installCommand - Install Commands. + * @param {string} params.buildCommand - Build Commands. + * @param {string} params.outputDirectory - Output Directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDeployment(params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; + /** + * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. + * + * @param {string} siteId - Site ID. + * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {string} installCommand - Install Commands. + * @param {string} buildCommand - Build Commands. + * @param {string} outputDirectory - Output Directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDeployment(siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; + let onProgress: ((progress: UploadProgress) => void); + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + siteId: paramsOrFirst as string, + code: rest[0] as File, + installCommand: rest[1] as string, + buildCommand: rest[2] as string, + outputDirectory: rest[3] as string, + activate: rest[4] as boolean + }; + onProgress = rest[5] as ((progress: UploadProgress) => void); + } + + const siteId = params.siteId; + const code = params.code; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const outputDirectory = params.outputDirectory; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'multipart/form-data', + } + + return this.client.chunkedUpload( + 'post', + uri, + apiHeaders, + payload, + onProgress + ); + } + + /** + * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDuplicateDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; + createDuplicateDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.repository - Repository name of the template. + * @param {string} params.owner - The name of the owner of the template. + * @param {string} params.rootDirectory - Path to site code in the template repo. + * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. + * + * @param {string} siteId - Site ID. + * @param {string} repository - Repository name of the template. + * @param {string} owner - The name of the owner of the template. + * @param {string} rootDirectory - Path to site code in the template repo. + * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createTemplateDeployment( + paramsOrFirst: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + repository: rest[0] as string, + owner: rest[1] as string, + rootDirectory: rest[2] as string, + type: rest[3] as TemplateReferenceType, + reference: rest[4] as string, + activate: rest[5] as boolean + }; + } + + const siteId = params.siteId; + const repository = params.repository; + const owner = params.owner; + const rootDirectory = params.rootDirectory; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof repository === 'undefined') { + throw new AppwriteException('Missing required parameter: "repository"'); + } + if (typeof owner === 'undefined') { + throw new AppwriteException('Missing required parameter: "owner"'); + } + if (typeof rootDirectory === 'undefined') { + throw new AppwriteException('Missing required parameter: "rootDirectory"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof repository !== 'undefined') { + payload['repository'] = repository; + } + if (typeof owner !== 'undefined') { + payload['owner'] = owner; + } + if (typeof rootDirectory !== 'undefined') { + payload['rootDirectory'] = rootDirectory; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a deployment when a site is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} params.siteId - Site ID. + * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit + * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment when a site is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} siteId - Site ID. + * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit + * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createVcsDeployment( + paramsOrFirst: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + type: rest[0] as VCSReferenceType, + reference: rest[1] as string, + activate: rest[2] as boolean + }; + } + + const siteId = params.siteId; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a site deployment by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + getDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Get a site deployment by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; + getDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + 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 site deployment by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; + /** + * Delete a site deployment by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDeployment(siteId: string, deploymentId: string): Promise<{}>; + deleteDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {string} + */ + getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + /** + * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {string} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload( + paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): string { + let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string, + type: rest[1] as DeploymentDownloadType + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + const type = params.type; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + payload['project'] = this.client.config.project; + payload['key'] = this.client.config.key; + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + + return uri.toString(); + } + + /** + * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDeploymentStatus(siteId: string, deploymentId: string): Promise<Models.Deployment>; + updateDeploymentStatus( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + 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( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all site logs. You can use the query params to filter your results. + * + * @param {string} params.siteId - Site 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + */ + listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; + /** + * Get a list of all site logs. You can use the query params to filter your results. + * + * @param {string} siteId - Site 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listLogs( + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.ExecutionList> { + let params: { siteId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId); + 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 a site request log by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + getLog(params: { siteId: string, logId: string }): Promise<Models.Execution>; + /** + * Get a site request log by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getLog(siteId: string, logId: string): Promise<Models.Execution>; + getLog( + paramsOrFirst: { siteId: string, logId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Execution> { + let params: { siteId: string, logId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, logId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + logId: rest[0] as string + }; + } + + const siteId = params.siteId; + const logId = params.logId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof logId === 'undefined') { + throw new AppwriteException('Missing required parameter: "logId"'); + } + + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + 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 site log by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteLog(params: { siteId: string, logId: string }): Promise<{}>; + /** + * Delete a site log by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteLog(siteId: string, logId: string): Promise<{}>; + deleteLog( + paramsOrFirst: { siteId: string, logId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, logId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, logId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + logId: rest[0] as string + }; + } + + const siteId = params.siteId; + const logId = params.logId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof logId === 'undefined') { + throw new AppwriteException('Missing required parameter: "logId"'); + } + + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all variables of a specific site. + * + * @param {string} params.siteId - Site unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all variables of a specific site. + * + * @param {string} siteId - Site unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listVariables(siteId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.VariableList> { + let params: { siteId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable 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.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + createVariable(params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable 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} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); + } + + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + getVariable(params: { siteId: string, variableId: string }): Promise<Models.Variable>; + /** + * Get a variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getVariable(siteId: string, variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { siteId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(siteId: string, variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { siteId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + 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/storage.ts b/src/services/storage.ts index 814b14b7..00f50cea 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -2,6 +2,7 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; @@ -12,6 +13,430 @@ export class Storage { this.client = client; } + /** + * Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.BucketList>} + */ + listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; + /** + * Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.BucketList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; + listBuckets( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.BucketList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/storage/buckets'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new storage bucket. + * + * @param {string} params.bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Bucket name + * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} params.transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + /** + * Create a new storage bucket. + * + * @param {string} bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Bucket name + * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + createBucket( + paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Bucket> { + let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + name: rest[0] as string, + permissions: rest[1] as string[], + fileSecurity: rest[2] as boolean, + enabled: rest[3] as boolean, + maximumFileSize: rest[4] as number, + allowedFileExtensions: rest[5] as string[], + compression: rest[6] as Compression, + encryption: rest[7] as boolean, + antivirus: rest[8] as boolean, + transformations: rest[9] as boolean + }; + } + + const bucketId = params.bucketId; + const name = params.name; + const permissions = params.permissions; + const fileSecurity = params.fileSecurity; + const enabled = params.enabled; + const maximumFileSize = params.maximumFileSize; + const allowedFileExtensions = params.allowedFileExtensions; + const compression = params.compression; + const encryption = params.encryption; + const antivirus = params.antivirus; + const transformations = params.transformations; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/storage/buckets'; + const payload: Payload = {}; + if (typeof bucketId !== 'undefined') { + payload['bucketId'] = bucketId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof fileSecurity !== 'undefined') { + payload['fileSecurity'] = fileSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof compression !== 'undefined') { + payload['compression'] = compression; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + if (typeof transformations !== 'undefined') { + payload['transformations'] = transformations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + * + * @param {string} params.bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + getBucket(params: { bucketId: string }): Promise<Models.Bucket>; + /** + * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + * + * @param {string} bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBucket(bucketId: string): Promise<Models.Bucket>; + getBucket( + paramsOrFirst: { bucketId: string } | string + ): Promise<Models.Bucket> { + let params: { bucketId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string }; + } else { + params = { + bucketId: paramsOrFirst as string + }; + } + + const bucketId = params.bucketId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a storage bucket by its unique ID. + * + * @param {string} params.bucketId - Bucket unique ID. + * @param {string} params.name - Bucket name + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} params.transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + /** + * Update a storage bucket by its unique ID. + * + * @param {string} bucketId - Bucket unique ID. + * @param {string} name - Bucket name + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + updateBucket( + paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Bucket> { + let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + name: rest[0] as string, + permissions: rest[1] as string[], + fileSecurity: rest[2] as boolean, + enabled: rest[3] as boolean, + maximumFileSize: rest[4] as number, + allowedFileExtensions: rest[5] as string[], + compression: rest[6] as Compression, + encryption: rest[7] as boolean, + antivirus: rest[8] as boolean, + transformations: rest[9] as boolean + }; + } + + const bucketId = params.bucketId; + const name = params.name; + const permissions = params.permissions; + const fileSecurity = params.fileSecurity; + const enabled = params.enabled; + const maximumFileSize = params.maximumFileSize; + const allowedFileExtensions = params.allowedFileExtensions; + const compression = params.compression; + const encryption = params.encryption; + const antivirus = params.antivirus; + const transformations = params.transformations; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof fileSecurity !== 'undefined') { + payload['fileSecurity'] = fileSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof compression !== 'undefined') { + payload['compression'] = compression; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + if (typeof transformations !== 'undefined') { + payload['transformations'] = transformations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a storage bucket by its unique ID. + * + * @param {string} params.bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBucket(params: { bucketId: string }): Promise<{}>; + /** + * Delete a storage bucket by its unique ID. + * + * @param {string} bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBucket(bucketId: string): Promise<{}>; + deleteBucket( + paramsOrFirst: { bucketId: string } | string + ): Promise<{}> { + let params: { bucketId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string }; + } else { + params = { + bucketId: paramsOrFirst as string + }; + } + + const bucketId = params.bucketId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -435,6 +860,7 @@ export class Storage { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -579,6 +1005,7 @@ export class Storage { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -646,6 +1073,7 @@ export class Storage { } payload['project'] = this.client.config.project; + payload['session'] = this.client.config.session; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index fa671f14..49d83748 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2,6 +2,10 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { RelationshipType } from '../enums/relationship-type'; +import { RelationMutate } from '../enums/relation-mutate'; +import { TablesDBIndexType } from '../enums/tables-db-index-type'; +import { OrderBy } from '../enums/order-by'; export class TablesDB { client: Client; @@ -10,6 +14,147 @@ export class TablesDB { this.client = client; } + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter 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 columns: name + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter 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 columns: name + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.DatabaseList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/tablesdb'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Database. + * + * + * @param {string} params.databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + */ + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Create a new Database. + * + * + * @param {string} databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create( + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/tablesdb'; + const payload: Payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + /** * List transactions across all databases. * @@ -344,79 +489,43 @@ export class TablesDB { } /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Database>} */ - listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; + get(params: { databaseId: string }): Promise<Models.Database>; /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; - listRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + get(databaseId: string): Promise<Models.Database>; + get( + paramsOrFirst: { databaseId: string } | string + ): Promise<Models.Database> { + let params: { databaseId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number + databaseId: paramsOrFirst as string }; } const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const transactionId = params.transactionId; - const total = params.total; - const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - 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 } = { @@ -431,85 +540,110 @@ export class TablesDB { } /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * Update a database by its unique ID. * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} params.rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. * @throws {AppwriteException} - * @returns {Promise<Row>} + * @returns {Promise<Models.Database>} */ - createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * Update a database by its unique ID. * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON 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 {string} transactionId - Transaction ID for staging the operation. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. * @throws {AppwriteException} - * @returns {Promise<Row>} + * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; - createRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update( + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name?: string, enabled?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; } else { params = { databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, - permissions: rest[3] as string[], - transactionId: rest[4] as string + name: rest[0] as string, + enabled: rest[1] as boolean }; } const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; + const name = params.name; + const enabled = params.enabled; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); const payload: Payload = {}; - if (typeof rowId !== 'undefined') { - payload['rowId'] = rowId; + if (typeof name !== 'undefined') { + payload['name'] = name; } - if (typeof data !== 'undefined') { - payload['data'] = data; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(databaseId: string): Promise<{}>; + delete( + paramsOrFirst: { databaseId: string } | string + ): Promise<{}> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -517,7 +651,4994 @@ export class TablesDB { } return this.client.call( - 'post', + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TableList>} + */ + listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; + listTables( + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.TableList> { + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Table name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {object[]} params.columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Table name. Max length: 128 chars. + * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {object[]} columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTable(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; + createTable( + paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + rowSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + columns: rest[5] as object[], + indexes: rest[6] as object[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const name = params.name; + const permissions = params.permissions; + const rowSecurity = params.rowSecurity; + const enabled = params.enabled; + const columns = params.columns; + const indexes = params.indexes; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof tableId !== 'undefined') { + payload['tableId'] = tableId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof columns !== 'undefined') { + payload['columns'] = columns; + } + if (typeof indexes !== 'undefined') { + payload['indexes'] = indexes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + getTable(params: { databaseId: string, tableId: string }): Promise<Models.Table>; + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTable(databaseId: string, tableId: string): Promise<Models.Table>; + getTable( + paramsOrFirst: { databaseId: string, tableId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a table by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.name - Table name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; + /** + * Update a table by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} name - Table name. Max length: 128 chars. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; + updateTable( + paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + rowSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + purge: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const name = params.name; + const permissions = params.permissions; + const rowSecurity = params.rowSecurity; + const enabled = params.enabled; + const purge = params.purge; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTable(databaseId: string, tableId: string): Promise<{}>; + deleteTable( + paramsOrFirst: { databaseId: string, tableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + 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 columns in the table. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table 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 columns: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnList>} + */ + listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; + /** + * List columns in the table. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table 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 columns: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; + listColumns( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ColumnList> { + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a bigint column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + */ + createBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; + /** + * Create a bigint column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; + createBigIntColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.ColumnBigint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a bigint column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + */ + updateBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; + /** + * Update a bigint column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; + updateBigIntColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.ColumnBigint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a boolean column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + */ + createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; + /** + * Create a boolean column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; + createBooleanColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnBoolean> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a boolean column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + */ + updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; + /** + * Update a boolean column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; + updateBooleanColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.ColumnBoolean> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + */ + createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; + createDatetimeColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnDatetime> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a date time column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + */ + updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; + /** + * Update a date time column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; + updateDatetimeColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnDatetime> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an email column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + */ + createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; + /** + * Create an email column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; + createEmailColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnEmail> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an email column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + */ + updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; + /** + * Update an email column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; + updateEmailColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnEmail> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {string[]} params.elements - Array of enum values. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + */ + createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; + /** + * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {string[]} elements - Array of enum values. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; + createEnumColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnEnum> { + let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an enum column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {string[]} params.elements - Updated list of enum values. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + */ + updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; + /** + * Update an enum column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {string[]} elements - Updated list of enum values. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; + updateEnumColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnEnum> { + let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a float column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number} params.min - Minimum value + * @param {number} params.max - Maximum value + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + */ + createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; + /** + * Create a float column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number} min - Minimum value + * @param {number} max - Maximum value + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; + createFloatColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + ): Promise<Models.ColumnFloat> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number, + max: rest[4] as number, + xdefault: rest[5] as number, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a float column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {number} params.min - Minimum value + * @param {number} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + */ + updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; + /** + * Update a float column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {number} min - Minimum value + * @param {number} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; + updateFloatColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.ColumnFloat> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number, + min: rest[4] as number, + max: rest[5] as number, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create an integer column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + */ + createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; + /** + * Create an integer column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; + createIntegerColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.ColumnInteger> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an integer column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + */ + updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; + /** + * Update an integer column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; + updateIntegerColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.ColumnInteger> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create IP address column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + */ + createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; + /** + * Create IP address column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; + createIpColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnIp> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an ip column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + */ + updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; + /** + * Update an ip column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; + updateIpColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnIp> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric line column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + */ + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; + /** + * Create a geometric line column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; + createLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnLine> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a line column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + */ + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; + /** + * Update a line column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; + updateLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnLine> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a longtext column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + */ + createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; + /** + * Create a longtext column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; + createLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnLongtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a longtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + */ + updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; + /** + * Update a longtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; + updateLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnLongtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a mediumtext column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + */ + createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; + /** + * Create a mediumtext column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; + createMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnMediumtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + */ + updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; + /** + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; + updateMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnMediumtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric point column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + */ + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; + /** + * Create a geometric point column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; + createPointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnPoint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + */ + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; + updatePointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnPoint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a geometric polygon column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + */ + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; + /** + * Create a geometric polygon column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; + createPolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnPolygon> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + */ + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; + updatePolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnPolygon> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.relatedTableId - Related Table ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Column Key. + * @param {string} params.twoWayKey - Two Way Column Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + */ + createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} relatedTableId - Related Table ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Column Key. + * @param {string} twoWayKey - Two Way Column Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; + createRelationshipColumn( + paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise<Models.ColumnRelationship> { + let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + relatedTableId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const relatedTableId = params.relatedTableId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof relatedTableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedTableId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof relatedTableId !== 'undefined') { + payload['relatedTableId'] = relatedTableId; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof twoWay !== 'undefined') { + payload['twoWay'] = twoWay; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof twoWayKey !== 'undefined') { + payload['twoWayKey'] = twoWayKey; + } + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a string column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for text columns, in number of characters. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. + */ + createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; + /** + * Create a string column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {number} size - Column size for text columns, in number of characters. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; + createStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the string column. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. + */ + updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; + /** + * Update a string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the string column. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; + updateStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a text column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + */ + createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; + /** + * Create a text column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; + createTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnText> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a text column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + */ + updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; + /** + * Update a text column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; + updateTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnText> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a URL column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + */ + createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; + /** + * Create a URL column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; + createUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnUrl> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an url column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + */ + updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; + /** + * Update an url column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; + updateUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnUrl> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a varchar column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for varchar columns, in number of characters. Maximum size is 16381. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + */ + createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; + /** + * Create a varchar column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {number} size - Column size for varchar columns, in number of characters. Maximum size is 16381. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; + createVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnVarchar> { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a varchar column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the varchar column. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + */ + updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; + /** + * Update a varchar column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the varchar column. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVarcharColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; + updateVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.ColumnVarchar> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get column by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} + */ + getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + /** + * Get column by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + getColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + 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 + ); + } + + /** + * Deletes a column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + /** + * Deletes a column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + */ + updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; + updateRelationshipColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise<Models.ColumnRelationship> { + let params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * List indexes on the table. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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 columns: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndexList>} + */ + listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; + /** + * List indexes on the table. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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 columns: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndexList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; + listIndexes( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ColumnIndexList> { + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + 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 + ); + } + + /** + * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. + * Type can be `key`, `fulltext`, or `unique`. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @param {TablesDBIndexType} params.type - Index type. + * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} params.lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + */ + createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; + /** + * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. + * Type can be `key`, `fulltext`, or `unique`. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @param {TablesDBIndexType} type - Index type. + * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex(databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; + createIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + ): Promise<Models.ColumnIndex> { + let params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + type: rest[2] as TablesDBIndexType, + columns: rest[3] as string[], + orders: rest[4] as OrderBy[], + lengths: rest[5] as number[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const type = params.type; + const columns = params.columns; + const orders = params.orders; + const lengths = params.lengths; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof columns === 'undefined') { + throw new AppwriteException('Missing required parameter: "columns"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof columns !== 'undefined') { + payload['columns'] = columns; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + payload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get index by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + */ + getIndex(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; + /** + * Get index by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex(databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; + getIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ColumnIndex> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + 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 index. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + /** + * Delete an index. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; + listRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const transactionId = params.transactionId; + const total = params.total; + const ttl = params.ttl; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 + ); + } + + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} params.rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON 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 {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; + createRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rowId !== 'undefined') { + payload['rowId'] = rowId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {object[]} params.rows - Array of rows data as JSON objects. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + createRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {object[]} rows - Array of rows data as JSON objects. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; + createRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rows: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rows = params.rows; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rows === 'undefined') { + throw new AppwriteException('Missing required parameter: "rows"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {object[]} params.rows - Array of row data as JSON objects. May contain partial rows. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + upsertRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {object[]} rows - Array of row data as JSON objects. May contain partial rows. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; + upsertRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rows: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rows = params.rows; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rows === 'undefined') { + throw new AppwriteException('Missing required parameter: "rows"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {object} params.data - Row data as JSON object. Include only column and value pairs to be updated. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + updateRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {object} data - Row data as JSON object. Include only column and value pairs to be updated. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + updateRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (object)?, (string[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + data: rest[1] as object, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const data = params.data; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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 + ); + } + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + deleteRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + deleteRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + 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/tokens.ts b/src/services/tokens.ts new file mode 100644 index 00000000..daffdae2 --- /dev/null +++ b/src/services/tokens.ts @@ -0,0 +1,315 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Tokens { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceTokenList>} + */ + list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise<Models.ResourceTokenList>; + /** + * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceTokenList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>; + list( + paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ResourceTokenList> { + let params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[], total?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const queries = params.queries; + const total = params.total; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File unique ID. + * @param {string} params.expire - Token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>; + /** + * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File unique ID. + * @param {string} expire - Token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>; + createFileToken( + paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ResourceToken> { + let params: { bucketId: string, fileId: string, expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + expire: rest[1] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const expire = params.expire; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a token by its unique ID. + * + * @param {string} params.tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + get(params: { tokenId: string }): Promise<Models.ResourceToken>; + /** + * Get a token by its unique ID. + * + * @param {string} tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(tokenId: string): Promise<Models.ResourceToken>; + get( + paramsOrFirst: { tokenId: string } | string + ): Promise<Models.ResourceToken> { + let params: { tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string }; + } else { + params = { + tokenId: paramsOrFirst as string + }; + } + + const tokenId = params.tokenId; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a token by its unique ID. Use this endpoint to update a token's expiry date. + * + * @param {string} params.tokenId - Token unique ID. + * @param {string} params.expire - File token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>; + /** + * Update a token by its unique ID. Use this endpoint to update a token's expiry date. + * + * @param {string} tokenId - Token unique ID. + * @param {string} expire - File token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(tokenId: string, expire?: string): Promise<Models.ResourceToken>; + update( + paramsOrFirst: { tokenId: string, expire?: string } | string, + ...rest: [(string)?] + ): Promise<Models.ResourceToken> { + let params: { tokenId: string, expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string, expire?: string }; + } else { + params = { + tokenId: paramsOrFirst as string, + expire: rest[0] as string + }; + } + + const tokenId = params.tokenId; + const expire = params.expire; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const payload: Payload = {}; + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a token by its unique ID. + * + * @param {string} params.tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { tokenId: string }): Promise<{}>; + /** + * Delete a token by its unique ID. + * + * @param {string} tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(tokenId: string): Promise<{}>; + delete( + paramsOrFirst: { tokenId: string } | string + ): Promise<{}> { + let params: { tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string }; + } else { + params = { + tokenId: paramsOrFirst as string + }; + } + + const tokenId = params.tokenId; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + 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/users.ts b/src/services/users.ts new file mode 100644 index 00000000..54df17b8 --- /dev/null +++ b/src/services/users.ts @@ -0,0 +1,3270 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { PasswordHash } from '../enums/password-hash'; +import { AuthenticatorType } from '../enums/authenticator-type'; +import { MessagingProviderType } from '../enums/messaging-provider-type'; + +export class Users { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's users. You can use the query params to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UserList<Preferences>>} + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.UserList<Preferences>>; + /** + * Get a list of all the project's users. You can use the query params to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UserList<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.UserList<Preferences>>; + list<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.UserList<Preferences>> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/users'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.password - Plain text user password. Must be at least 8 chars. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. + * + * @param {string} userId - User 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} email - User email. + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} password - Plain text user password. Must be at least 8 chars. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>>; + create<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email?: string, phone?: string, password?: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email?: string, phone?: string, password?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email?: string, phone?: string, password?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + phone: rest[1] as string, + password: rest[2] as string, + name: rest[3] as string + }; + } + + const userId = params.userId; + const email = params.email; + const phone = params.phone; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using Argon2. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using Argon2. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/argon2'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using Bcrypt. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using Bcrypt. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/bcrypt'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get identities for all users. + * + * @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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + */ + listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.IdentityList>; + /** + * Get identities for all users. + * + * @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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIdentities(queries?: string[], search?: string, total?: boolean): Promise<Models.IdentityList>; + listIdentities( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.IdentityList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/users/identities'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + 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 + ); + } + + /** + * Delete an identity by its unique ID. + * + * @param {string} params.identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIdentity(params: { identityId: string }): Promise<{}>; + /** + * Delete an identity by its unique ID. + * + * @param {string} identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIdentity(identityId: string): Promise<{}>; + deleteIdentity( + paramsOrFirst: { identityId: string } | string + ): Promise<{}> { + let params: { identityId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { identityId: string }; + } else { + params = { + identityId: paramsOrFirst as string + }; + } + + const identityId = params.identityId; + + if (typeof identityId === 'undefined') { + throw new AppwriteException('Missing required parameter: "identityId"'); + } + + const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using MD5. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using MD5. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/md5'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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.email - User email. + * @param {string} params.password - User password hashed using PHPass. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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} email - User email. + * @param {string} password - User password hashed using PHPass. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/phpass'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using Scrypt. + * @param {string} params.passwordSalt - Optional salt used to hash password. + * @param {number} params.passwordCpu - Optional CPU cost used to hash password. + * @param {number} params.passwordMemory - Optional memory cost used to hash password. + * @param {number} params.passwordParallel - Optional parallelization cost used to hash password. + * @param {number} params.passwordLength - Optional hash length used to hash password. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using Scrypt. + * @param {string} passwordSalt - Optional salt used to hash password. + * @param {number} passwordCpu - Optional CPU cost used to hash password. + * @param {number} passwordMemory - Optional memory cost used to hash password. + * @param {number} passwordParallel - Optional parallelization cost used to hash password. + * @param {number} passwordLength - Optional hash length used to hash password. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>; + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordSalt: rest[2] as string, + passwordCpu: rest[3] as number, + passwordMemory: rest[4] as number, + passwordParallel: rest[5] as number, + passwordLength: rest[6] as number, + name: rest[7] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordSalt = params.passwordSalt; + const passwordCpu = params.passwordCpu; + const passwordMemory = params.passwordMemory; + const passwordParallel = params.passwordParallel; + const passwordLength = params.passwordLength; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + if (typeof passwordSalt === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSalt"'); + } + if (typeof passwordCpu === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordCpu"'); + } + if (typeof passwordMemory === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordMemory"'); + } + if (typeof passwordParallel === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordParallel"'); + } + if (typeof passwordLength === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordLength"'); + } + + const apiPath = '/users/scrypt'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordSalt !== 'undefined') { + payload['passwordSalt'] = passwordSalt; + } + if (typeof passwordCpu !== 'undefined') { + payload['passwordCpu'] = passwordCpu; + } + if (typeof passwordMemory !== 'undefined') { + payload['passwordMemory'] = passwordMemory; + } + if (typeof passwordParallel !== 'undefined') { + payload['passwordParallel'] = passwordParallel; + } + if (typeof passwordLength !== 'undefined') { + payload['passwordLength'] = passwordLength; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using Scrypt Modified. + * @param {string} params.passwordSalt - Salt used to hash password. + * @param {string} params.passwordSaltSeparator - Salt separator used to hash password. + * @param {string} params.passwordSignerKey - Signer key used to hash password. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using Scrypt Modified. + * @param {string} passwordSalt - Salt used to hash password. + * @param {string} passwordSaltSeparator - Salt separator used to hash password. + * @param {string} passwordSignerKey - Signer key used to hash password. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>>; + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordSalt: rest[2] as string, + passwordSaltSeparator: rest[3] as string, + passwordSignerKey: rest[4] as string, + name: rest[5] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordSalt = params.passwordSalt; + const passwordSaltSeparator = params.passwordSaltSeparator; + const passwordSignerKey = params.passwordSignerKey; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + if (typeof passwordSalt === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSalt"'); + } + if (typeof passwordSaltSeparator === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); + } + if (typeof passwordSignerKey === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); + } + + const apiPath = '/users/scrypt-modified'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordSalt !== 'undefined') { + payload['passwordSalt'] = passwordSalt; + } + if (typeof passwordSaltSeparator !== 'undefined') { + payload['passwordSaltSeparator'] = passwordSaltSeparator; + } + if (typeof passwordSignerKey !== 'undefined') { + payload['passwordSignerKey'] = passwordSignerKey; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User 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.email - User email. + * @param {string} params.password - User password hashed using SHA. + * @param {PasswordHash} params.passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User 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} email - User email. + * @param {string} password - User password hashed using SHA. + * @param {PasswordHash} passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise<Models.User<Preferences>>; + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string } | string, + ...rest: [(string)?, (string)?, (PasswordHash)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordVersion: rest[2] as PasswordHash, + name: rest[3] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordVersion = params.passwordVersion; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/sha'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordVersion !== 'undefined') { + payload['passwordVersion'] = passwordVersion; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a user by its unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Models.User<Preferences>>; + /** + * Get a user by its unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Models.User<Preferences>>; + get<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string } | string + ): Promise<Models.User<Preferences>> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}'.replace('{userId}', userId); + 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 user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { userId: string }): Promise<{}>; + /** + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(userId: string): Promise<{}>; + delete( + paramsOrFirst: { userId: string } | string + ): Promise<{}> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user email by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.email - User email. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string }): Promise<Models.User<Preferences>>; + /** + * Update the user email by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} email - User email. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>; + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string + }; + } + + const userId = params.userId; + const email = params.email; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + + const apiPath = '/users/{userId}/email'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + 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 + ); + } + + /** + * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. + * + * + * @param {string} params.userId - User ID. + * @param {boolean} params.impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, impersonator: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. + * + * + * @param {string} userId - User ID. + * @param {boolean} impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>; + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, impersonator: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, impersonator: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + impersonator: rest[0] as boolean + }; + } + + const userId = params.userId; + const impersonator = params.impersonator; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof impersonator === 'undefined') { + throw new AppwriteException('Missing required parameter: "impersonator"'); + } + + const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof impersonator !== 'undefined') { + payload['impersonator'] = impersonator; + } + 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 + ); + } + + /** + * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + * + * @param {string} params.userId - User ID. + * @param {string} params.sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + */ + createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise<Models.Jwt>; + /** + * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + * + * @param {string} userId - User ID. + * @param {string} sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt>; + createJWT( + paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string, + ...rest: [(string)?, (number)?] + ): Promise<Models.Jwt> { + let params: { userId: string, sessionId?: string, duration?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number }; + } else { + params = { + userId: paramsOrFirst as string, + sessionId: rest[0] as string, + duration: rest[1] as number + }; + } + + const userId = params.userId; + const sessionId = params.sessionId; + const duration = params.duration; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof sessionId !== 'undefined') { + payload['sessionId'] = sessionId; + } + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * @param {string} params.userId - User ID. + * @param {string[]} params.labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, labels: string[] }): Promise<Models.User<Preferences>>; + /** + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * @param {string} userId - User ID. + * @param {string[]} labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>>; + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, labels: string[] } | string, + ...rest: [(string[])?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, labels: string[] }; + } else { + params = { + userId: paramsOrFirst as string, + labels: rest[0] as string[] + }; + } + + const userId = params.userId; + const labels = params.labels; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the user activity logs list by its unique ID. + * + * @param {string} params.userId - User 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). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the user activity logs list by its unique ID. + * + * @param {string} userId - User 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). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listLogs(userId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listLogs( + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { userId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); + 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 the user membership list by its unique ID. + * + * @param {string} params.userId - User 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: userId, teamId, invited, joined, confirm, roles + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + */ + listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; + /** + * Get the user membership list by its unique ID. + * + * @param {string} userId - User 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: userId, teamId, invited, joined, confirm, roles + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; + listMemberships( + paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.MembershipList> { + let params: { userId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + 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 + ); + } + + /** + * Enable or disable MFA on a user account. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. + */ + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable MFA on a user account. + * + * @param {string} userId - User ID. + * @param {boolean} mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, mfa: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, mfa: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + mfa: rest[0] as boolean + }; + } + + const userId = params.userId; + const mfa = params.mfa; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof mfa === 'undefined') { + throw new AppwriteException('Missing required parameter: "mfa"'); + } + + const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof mfa !== 'undefined') { + payload['mfa'] = mfa; + } + 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 + ); + } + + /** + * Enable or disable MFA on a user account. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable MFA on a user account. + * + * @param {string} userId - User ID. + * @param {boolean} mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, mfa: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, mfa: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + mfa: rest[0] as boolean + }; + } + + const userId = params.userId; + const mfa = params.mfa; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof mfa === 'undefined') { + throw new AppwriteException('Missing required parameter: "mfa"'); + } + + const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof mfa !== 'undefined') { + payload['mfa'] = mfa; + } + 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 an authenticator app. + * + * @param {string} params.userId - User ID. + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. + */ + deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator app. + * + * @param {string} userId - User ID. + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; + deleteMfaAuthenticator( + paramsOrFirst: { userId: string, type: AuthenticatorType } | string, + ...rest: [(AuthenticatorType)?] + ): Promise<{}> { + let params: { userId: string, type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; + } else { + params = { + userId: paramsOrFirst as string, + type: rest[0] as AuthenticatorType + }; + } + + const userId = params.userId; + const type = params.type; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + 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 + ); + } + + /** + * Delete an authenticator app. + * + * @param {string} params.userId - User ID. + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator app. + * + * @param {string} userId - User ID. + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMFAAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; + deleteMFAAuthenticator( + paramsOrFirst: { userId: string, type: AuthenticatorType } | string, + ...rest: [(AuthenticatorType)?] + ): Promise<{}> { + let params: { userId: string, type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; + } else { + params = { + userId: paramsOrFirst as string, + type: rest[0] as AuthenticatorType + }; + } + + const userId = params.userId; + const type = params.type; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + 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 factors available on the account to be used as a MFA challange. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead. + */ + listMfaFactors(params: { userId: string }): Promise<Models.MfaFactors>; + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMfaFactors(userId: string): Promise<Models.MfaFactors>; + listMfaFactors( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaFactors> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + 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 + ); + } + + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + */ + listMFAFactors(params: { userId: string }): Promise<Models.MfaFactors>; + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMFAFactors(userId: string): Promise<Models.MfaFactors>; + listMFAFactors( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaFactors> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + 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 + ); + } + + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. + */ + getMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + getMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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 + ); + } + + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + getMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + getMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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 + ); + } + + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. + */ + updateMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + updateMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + updateMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + updateMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. + */ + createMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + createMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + createMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + createMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + 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( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user name by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, name: string }): Promise<Models.User<Preferences>>; + /** + * Update the user name by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, name: string): Promise<Models.User<Preferences>>; + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, name: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, name: string }; + } else { + params = { + userId: paramsOrFirst as string, + name: rest[0] as string + }; + } + + const userId = params.userId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/users/{userId}/name'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user password by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.password - New user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, password: string }): Promise<Models.User<Preferences>>; + /** + * Update the user password by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} password - New user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, password: string): Promise<Models.User<Preferences>>; + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, password: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, password: string }; + } else { + params = { + userId: paramsOrFirst as string, + password: rest[0] as string + }; + } + + const userId = params.userId; + const password = params.password; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/{userId}/password'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user phone by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.number - User phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, number: string }): Promise<Models.User<Preferences>>; + /** + * Update the user phone by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} number - User phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, number: string): Promise<Models.User<Preferences>>; + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, number: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, number: string }; + } else { + params = { + userId: paramsOrFirst as string, + number: rest[0] as string + }; + } + + const userId = params.userId; + const number = params.number; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the user preferences by its unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Preferences>; + /** + * Get the user preferences by its unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Preferences>; + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string } | string + ): Promise<Preferences> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param {string} params.userId - User ID. + * @param {object} params.prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, prefs: object }): Promise<Preferences>; + /** + * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param {string} userId - User ID. + * @param {object} prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, prefs: object): Promise<Preferences>; + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, prefs: object } | string, + ...rest: [(object)?] + ): Promise<Preferences> { + let params: { userId: string, prefs: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, prefs: object }; + } else { + params = { + userId: paramsOrFirst as string, + prefs: rest[0] as object + }; + } + + const userId = params.userId; + const prefs = params.prefs; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Get the user sessions list by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + */ + listSessions(params: { userId: string, total?: boolean }): Promise<Models.SessionList>; + /** + * Get the user sessions list by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSessions(userId: string, total?: boolean): Promise<Models.SessionList>; + listSessions( + paramsOrFirst: { userId: string, total?: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.SessionList> { + let params: { userId: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + total: rest[0] as boolean + }; + } + + const userId = params.userId; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + createSession(params: { userId: string }): Promise<Models.Session>; + /** + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSession(userId: string): Promise<Models.Session>; + createSession( + paramsOrFirst: { userId: string } | string + ): Promise<Models.Session> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + 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( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete all user's sessions by using the user's unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSessions(params: { userId: string }): Promise<{}>; + /** + * Delete all user's sessions by using the user's unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSessions(userId: string): Promise<{}>; + deleteSessions( + paramsOrFirst: { userId: string } | string + ): Promise<{}> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + 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 + ); + } + + /** + * Delete a user sessions by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.sessionId - Session ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; + /** + * Delete a user sessions by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} sessionId - Session ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSession(userId: string, sessionId: string): Promise<{}>; + deleteSession( + paramsOrFirst: { userId: string, sessionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { userId: string, sessionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, sessionId: string }; + } else { + params = { + userId: paramsOrFirst as string, + sessionId: rest[0] as string + }; + } + + const userId = params.userId; + const sessionId = params.sessionId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + + const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.status - User Status. To activate the user pass `true` and to block the user pass `false`. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, status: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * + * @param {string} userId - User ID. + * @param {boolean} status - User Status. To activate the user pass `true` and to block the user pass `false`. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>; + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, status: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, status: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, status: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + status: rest[0] as boolean + }; + } + + const userId = params.userId; + const status = params.status; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/users/{userId}/status'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * List the messaging targets that are associated with a user. + * + * @param {string} params.userId - User 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: userId, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + */ + listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; + /** + * List the messaging targets that are associated with a user. + * + * @param {string} userId - User 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: userId, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTargets(userId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; + listTargets( + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.TargetList> { + let params: { userId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a messaging target. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target 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 {MessagingProviderType} params.providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. + * @param {string} params.identifier - The target identifier (token, email, phone etc.) + * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise<Models.Target>; + /** + * Create a messaging target. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target 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 {MessagingProviderType} providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. + * @param {string} identifier - The target identifier (token, email, phone etc.) + * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise<Models.Target>; + createTarget( + paramsOrFirst: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string } | string, + ...rest: [(string)?, (MessagingProviderType)?, (string)?, (string)?, (string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string, + providerType: rest[1] as MessagingProviderType, + identifier: rest[2] as string, + providerId: rest[3] as string, + name: rest[4] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + const providerType = params.providerType; + const identifier = params.identifier; + const providerId = params.providerId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + if (typeof providerType === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerType"'); + } + if (typeof identifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "identifier"'); + } + + const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof targetId !== 'undefined') { + payload['targetId'] = targetId; + } + if (typeof providerType !== 'undefined') { + payload['providerType'] = providerType; + } + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a user's push notification target by ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + getTarget(params: { userId: string, targetId: string }): Promise<Models.Target>; + /** + * Get a user's push notification target by ID. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTarget(userId: string, targetId: string): Promise<Models.Target>; + getTarget( + paramsOrFirst: { userId: string, targetId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a messaging target. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @param {string} params.identifier - The target identifier (token, email, phone etc.) + * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise<Models.Target>; + /** + * Update a messaging target. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @param {string} identifier - The target identifier (token, email, phone etc.) + * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target>; + updateTarget( + paramsOrFirst: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string, + identifier: rest[1] as string, + providerId: rest[2] as string, + name: rest[3] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + const identifier = params.identifier; + const providerId = params.providerId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const payload: Payload = {}; + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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 messaging target. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; + /** + * Delete a messaging target. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTarget(userId: string, targetId: string): Promise<{}>; + deleteTarget( + paramsOrFirst: { userId: string, targetId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { userId: string, targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + 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 + ); + } + + /** + * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + * + * + * @param {string} params.userId - User ID. + * @param {number} params.length - Token length in characters. The default length is 6 characters + * @param {number} params.expire - Token expiration period in seconds. The default expiration is 15 minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createToken(params: { userId: string, length?: number, expire?: number }): Promise<Models.Token>; + /** + * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + * + * + * @param {string} userId - User ID. + * @param {number} length - Token length in characters. The default length is 6 characters + * @param {number} expire - Token expiration period in seconds. The default expiration is 15 minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createToken(userId: string, length?: number, expire?: number): Promise<Models.Token>; + createToken( + paramsOrFirst: { userId: string, length?: number, expire?: number } | string, + ...rest: [(number)?, (number)?] + ): Promise<Models.Token> { + let params: { userId: string, length?: number, expire?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, length?: number, expire?: number }; + } else { + params = { + userId: paramsOrFirst as string, + length: rest[0] as number, + expire: rest[1] as number + }; + } + + const userId = params.userId; + const length = params.length; + const expire = params.expire; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof length !== 'undefined') { + payload['length'] = length; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user email verification status by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.emailVerification - User email verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, emailVerification: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user email verification status by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} emailVerification - User email verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>; + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, emailVerification: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, emailVerification: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, emailVerification: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + emailVerification: rest[0] as boolean + }; + } + + const userId = params.userId; + const emailVerification = params.emailVerification; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof emailVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "emailVerification"'); + } + + const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof emailVerification !== 'undefined') { + payload['emailVerification'] = emailVerification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the user phone verification status by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.phoneVerification - User phone verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, phoneVerification: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user phone verification status by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} phoneVerification - User phone verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>; + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, phoneVerification: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, phoneVerification: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, phoneVerification: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + phoneVerification: rest[0] as boolean + }; + } + + const userId = params.userId; + const phoneVerification = params.phoneVerification; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof phoneVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "phoneVerification"'); + } + + const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof phoneVerification !== 'undefined') { + payload['phoneVerification'] = phoneVerification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts new file mode 100644 index 00000000..ee3cd84f --- /dev/null +++ b/src/services/webhooks.ts @@ -0,0 +1,466 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Webhooks { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.WebhookList>} + */ + list(params?: { queries?: string[], total?: boolean }): Promise<Models.WebhookList>; + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.WebhookList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise<Models.WebhookList>; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.WebhookList> { + 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 = '/webhooks'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} params.webhookId - Webhook 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.url - Webhook URL. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }): Promise<Models.Webhook>; + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} webhookId - Webhook 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} url - Webhook URL. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string): Promise<Models.Webhook>; + create( + paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + url: rest[0] as string, + name: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string, + secret: rest[7] as string + }; + } + + const webhookId = params.webhookId; + const url = params.url; + const name = params.name; + const events = params.events; + const enabled = params.enabled; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; + const secret = params.secret; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks'; + const payload: Payload = {}; + if (typeof webhookId !== 'undefined') { + payload['webhookId'] = webhookId; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof tls !== 'undefined') { + payload['tls'] = tls; + } + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; + } + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + get(params: { webhookId: string }): Promise<Models.Webhook>; + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(webhookId: string): Promise<Models.Webhook>; + get( + paramsOrFirst: { webhookId: string } | string + ): Promise<Models.Webhook> { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string} params.url - Webhook URL. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise<Models.Webhook>; + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} webhookId - Webhook ID. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string} url - Webhook URL. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise<Models.Webhook>; + update( + paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + name: rest[0] as string, + url: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string + }; + } + + const webhookId = params.webhookId; + const name = params.name; + const url = params.url; + const events = params.events; + const enabled = params.enabled; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof tls !== 'undefined') { + payload['tls'] = tls; + } + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; + } + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { webhookId: string }): Promise<{}>; + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(webhookId: string): Promise<{}>; + delete( + paramsOrFirst: { webhookId: string } | string + ): Promise<{}> { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + updateSecret(params: { webhookId: string, secret?: string }): Promise<Models.Webhook>; + /** + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} webhookId - Webhook ID. + * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSecret(webhookId: string, secret?: string): Promise<Models.Webhook>; + updateSecret( + paramsOrFirst: { webhookId: string, secret?: string } | string, + ...rest: [(string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, secret?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, secret?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const webhookId = params.webhookId; + const secret = params.secret; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + 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 + ); + } +} From e044cb19cd1e31ed065aab8fc6ed2831acd074d5 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Fri, 15 May 2026 14:56:40 +0530 Subject: [PATCH 3/5] chore: regenerate Web SDK with updated isomorphic-sdks generator --- .github/workflows/publish.yml | 4 +- .npmrc | 1 + .../account/create-anonymous-session.md | 3 +- .../account/create-email-password-session.md | 3 +- docs/examples/account/create-email-token.md | 3 +- .../account/create-email-verification.md | 3 +- docs/examples/account/create-jwt.md | 3 +- .../account/create-magic-url-token.md | 3 +- .../account/create-mfa-authenticator.md | 3 +- docs/examples/account/create-mfa-challenge.md | 3 +- .../account/create-mfa-recovery-codes.md | 3 +- .../account/create-o-auth-2-session.md | 17 - .../examples/account/create-o-auth-2-token.md | 3 +- docs/examples/account/create-phone-token.md | 3 +- .../account/create-phone-verification.md | 3 +- docs/examples/account/create-push-target.md | 17 - docs/examples/account/create-recovery.md | 3 +- docs/examples/account/create-session.md | 3 +- docs/examples/account/create-verification.md | 3 +- docs/examples/account/create.md | 3 +- docs/examples/account/delete-identity.md | 3 +- .../account/delete-mfa-authenticator.md | 3 +- docs/examples/account/delete-push-target.md | 15 - docs/examples/account/delete-session.md | 3 +- docs/examples/account/delete-sessions.md | 3 +- .../account/get-mfa-recovery-codes.md | 3 +- docs/examples/account/get-prefs.md | 3 +- docs/examples/account/get-session.md | 3 +- docs/examples/account/get.md | 3 +- docs/examples/account/list-identities.md | 3 +- docs/examples/account/list-logs.md | 3 +- docs/examples/account/list-mfa-factors.md | 3 +- docs/examples/account/list-sessions.md | 3 +- .../account/update-email-verification.md | 3 +- docs/examples/account/update-email.md | 3 +- .../account/update-magic-url-session.md | 3 +- .../account/update-mfa-authenticator.md | 3 +- docs/examples/account/update-mfa-challenge.md | 3 +- .../account/update-mfa-recovery-codes.md | 3 +- docs/examples/account/update-mfa.md | 3 +- docs/examples/account/update-name.md | 3 +- docs/examples/account/update-password.md | 3 +- docs/examples/account/update-phone-session.md | 3 +- .../account/update-phone-verification.md | 3 +- docs/examples/account/update-phone.md | 3 +- docs/examples/account/update-prefs.md | 3 +- docs/examples/account/update-push-target.md | 16 - docs/examples/account/update-recovery.md | 3 +- docs/examples/account/update-session.md | 3 +- docs/examples/account/update-status.md | 3 +- docs/examples/account/update-verification.md | 3 +- docs/examples/avatars/get-browser.md | 3 +- docs/examples/avatars/get-credit-card.md | 3 +- docs/examples/avatars/get-favicon.md | 3 +- docs/examples/avatars/get-flag.md | 3 +- docs/examples/avatars/get-image.md | 3 +- docs/examples/avatars/get-initials.md | 3 +- docs/examples/avatars/get-qr.md | 3 +- docs/examples/avatars/get-screenshot.md | 3 +- docs/examples/databases/create-document.md | 3 +- .../databases/decrement-document-attribute.md | 3 +- docs/examples/databases/delete-document.md | 3 +- docs/examples/databases/get-document.md | 3 +- .../databases/increment-document-attribute.md | 3 +- docs/examples/databases/list-documents.md | 3 +- docs/examples/databases/update-document.md | 3 +- docs/examples/databases/upsert-document.md | 3 +- docs/examples/functions/create-execution.md | 3 +- docs/examples/functions/get-execution.md | 3 +- docs/examples/functions/list-executions.md | 3 +- docs/examples/locale/get.md | 3 +- docs/examples/locale/list-codes.md | 3 +- docs/examples/locale/list-continents.md | 3 +- docs/examples/locale/list-countries-eu.md | 3 +- docs/examples/locale/list-countries-phones.md | 3 +- docs/examples/locale/list-countries.md | 3 +- docs/examples/locale/list-currencies.md | 3 +- docs/examples/locale/list-languages.md | 3 +- docs/examples/storage/create-file.md | 3 +- docs/examples/storage/delete-file.md | 3 +- docs/examples/storage/get-file-download.md | 3 +- docs/examples/storage/get-file-preview.md | 3 +- docs/examples/storage/get-file-view.md | 3 +- docs/examples/storage/get-file.md | 3 +- docs/examples/storage/list-files.md | 3 +- docs/examples/storage/update-file.md | 3 +- docs/examples/tablesdb/create-row.md | 3 +- .../examples/tablesdb/decrement-row-column.md | 3 +- docs/examples/tablesdb/delete-row.md | 3 +- docs/examples/tablesdb/get-row.md | 3 +- .../examples/tablesdb/increment-row-column.md | 3 +- docs/examples/tablesdb/list-rows.md | 3 +- docs/examples/tablesdb/update-row.md | 3 +- docs/examples/tablesdb/upsert-row.md | 3 +- docs/examples/teams/create-membership.md | 3 +- docs/examples/teams/create.md | 3 +- docs/examples/teams/delete-membership.md | 3 +- docs/examples/teams/delete.md | 3 +- docs/examples/teams/get-membership.md | 3 +- docs/examples/teams/get-prefs.md | 3 +- docs/examples/teams/get.md | 3 +- docs/examples/teams/list-memberships.md | 3 +- docs/examples/teams/list.md | 3 +- .../teams/update-membership-status.md | 3 +- docs/examples/teams/update-membership.md | 3 +- docs/examples/teams/update-name.md | 3 +- docs/examples/teams/update-prefs.md | 3 +- src/client.ts | 386 ++++++++++++------ src/index.ts | 2 +- src/services/account.ts | 28 +- src/services/activities.ts | 17 +- src/services/avatars.ts | 56 ++- src/services/backups.ts | 17 +- src/services/databases.ts | 249 +++++------ src/services/functions.ts | 114 +++--- src/services/graphql.ts | 25 +- src/services/health.ts | 17 +- src/services/locale.ts | 25 +- src/services/messaging.ts | 241 ++++++----- src/services/project.ts | 17 +- src/services/proxy.ts | 17 +- src/services/realtime.ts | 34 +- src/services/sites.ts | 20 +- src/services/storage.ts | 56 ++- src/services/tables-db.ts | 249 +++++------ src/services/teams.ts | 25 +- src/services/tokens.ts | 17 +- src/services/users.ts | 17 +- src/services/webhooks.ts | 17 +- 129 files changed, 1117 insertions(+), 902 deletions(-) create mode 100644 .npmrc delete mode 100644 docs/examples/account/create-o-auth-2-session.md delete mode 100644 docs/examples/account/create-push-target.md delete mode 100644 docs/examples/account/delete-push-target.md delete mode 100644 docs/examples/account/update-push-target.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 47ba2484..ee63d526 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Use Node.js - uses: actions/setup-node@v6 + 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 00000000..7253a5ce --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +min-release-age=7 diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index d7df4a9f..818f50a4 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index b825eab9..4010b91f 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index d220d8a0..940a7f70 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index b656e027..a3e378d2 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 4d75ed92..0ba2d266 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 5b7a3f78..59d1aaf0 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index ceaf306b..cf6a6098 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -3,8 +3,7 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index ee23dcc2..d9d9856d 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -3,8 +3,7 @@ import { Client, Account, AuthenticationFactor } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index e2cf3146..3c292f26 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-o-auth-2-session.md b/docs/examples/account/create-o-auth-2-session.md deleted file mode 100644 index 734b6972..00000000 --- a/docs/examples/account/create-o-auth-2-session.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Account, OAuthProvider } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const account = new Account(client); - -account.createOAuth2Session({ - provider: OAuthProvider.Amazon, - success: 'https://example.com', // optional - failure: 'https://example.com', // optional - scopes: [] // optional -}); - -``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 9c17d4b7..f6187249 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -3,8 +3,7 @@ import { Client, Account, OAuthProvider } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 284b8078..78812e33 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 8b862715..9c0ea143 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md deleted file mode 100644 index 39f4d48a..00000000 --- a/docs/examples/account/create-push-target.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Account } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const account = new Account(client); - -const result = await account.createPushTarget({ - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 6448093f..0f4e7a91 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 5d7d8be6..1639c12c 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 8e983ef0..0795d0ac 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 55d2b261..a78197cd 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 6c2ae43f..d63addb7 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 5d51b800..079f0b95 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -3,8 +3,7 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md deleted file mode 100644 index 38d0ed5a..00000000 --- a/docs/examples/account/delete-push-target.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Account } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const account = new Account(client); - -const result = await account.deletePushTarget({ - targetId: '<TARGET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index c42412bd..9d2b8f3e 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 17e829fa..d7df883e 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 324dda73..1d102583 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 216f3337..9e2d5e25 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 5992c100..83ac4b0a 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 89021c15..0b6c59e3 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 87b664ae..8dee4b39 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index c2097ec1..91be728f 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index be51706f..9950129b 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index a7eab3f0..2dae7488 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index 33cbbeb6..f3e8b619 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index d328a939..0bd7d36c 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index faba9344..d0598719 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index a71308fc..bf25c76b 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -3,8 +3,7 @@ import { Client, Account, AuthenticatorType } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index a44a9954..a16ea43a 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index dd88f692..8bc8273c 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index cea7b2ae..f17ca2b1 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 305118df..3e184d75 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index abb7d066..360c577f 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 704b934e..5352cf0a 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 8125dd7a..2ddd0f13 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index e46a27aa..9f640a12 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index 0ccc64ba..ca2841b7 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md deleted file mode 100644 index 7c14aa3b..00000000 --- a/docs/examples/account/update-push-target.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Account } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const account = new Account(client); - -const result = await account.updatePushTarget({ - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>' -}); - -console.log(result); -``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 5eec4923..e08d48cb 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 3324081c..9159580f 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index c8aab7ab..ac2aa48e 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 3364d117..3b52a83c 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -3,8 +3,7 @@ import { Client, Account } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 69da700f..d4c1a40f 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -3,8 +3,7 @@ import { Client, Avatars, Browser } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index f0d07fae..57758501 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -3,8 +3,7 @@ import { Client, Avatars, CreditCard } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 8f9831e7..8b09f65f 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -3,8 +3,7 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 2460f36c..d24b9b40 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -3,8 +3,7 @@ import { Client, Avatars, Flag } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index d0fee491..f8f33731 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -3,8 +3,7 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index c038261a..0722a72d 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -3,8 +3,7 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index e7ad12c1..829c7121 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -3,8 +3,7 @@ import { Client, Avatars } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 37752c17..8804b1e8 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -3,8 +3,7 @@ import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index d7f5d94a..4d8d7f90 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,8 +3,7 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 739859a0..c657bd49 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index a7c963ec..95665088 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 5efbd4c7..ad11eb8d 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index b8379897..51eec6d5 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 947814e1..5444dffb 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 8421a7cd..df5651d8 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -3,8 +3,7 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 47e384eb..212964a6 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -3,8 +3,7 @@ import { Client, Databases, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index dd1d9c2b..71dd8cc3 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -3,8 +3,7 @@ import { Client, Functions, ExecutionMethod } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 14839a09..a9b22e29 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -3,8 +3,7 @@ import { Client, Functions } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 6f021c4f..55aa3cb7 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -3,8 +3,7 @@ import { Client, Functions } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 20035e4f..95e92c4c 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index e00ac0e8..d6e9d33b 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index beadd6e8..6af2b7f4 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 647a2864..92b3fa08 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index ba27ba71..517a19a3 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 4f4306e6..f92f9985 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 46aed9cc..50c0f222 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 57e5ee15..a3afe001 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -3,8 +3,7 @@ import { Client, Locale } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 58cb7cdf..b70885b2 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -3,8 +3,7 @@ import { Client, Storage, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index de5be7ba..950003b8 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -3,8 +3,7 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 5aad168a..7758c7b4 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -3,8 +3,7 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index ca28c6d2..4d01ef0c 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -3,8 +3,7 @@ import { Client, Storage, ImageGravity, ImageFormat } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 5e7df139..682e947c 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -3,8 +3,7 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 7542ff53..82607140 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -3,8 +3,7 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 5d97d6e2..f2dd2f44 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -3,8 +3,7 @@ import { Client, Storage } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 4c41be57..eef78a1d 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -3,8 +3,7 @@ import { Client, Storage, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 46f09b4e..105c4445 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -3,8 +3,7 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index faffbcf3..bad89263 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 5d47e8ec..12663286 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 688b96df..14316385 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index d671cbc5..2fa3354b 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 3259ce0e..455ec6fe 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index ee7c4440..77a775b3 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -3,8 +3,7 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 46a8f9d4..fb971043 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -3,8 +3,7 @@ import { Client, TablesDB, Permission, Role } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 4b55200b..5a23e078 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 7c996a2d..2c72bcdf 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 52c2e773..2fe13278 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 053dac1a..054e34ef 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 3d0b92a0..bdd6c784 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 7142bbbc..bf20ed47 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 7def82d9..836a8e08 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 004da4c3..fd3fcd30 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index e5ed2c9e..3406925f 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 0f7dacc6..2ca1c62d 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 9fac38ab..ecfd1bc8 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index f78ed579..dce11078 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 32404b3a..2c8a15a1 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -3,8 +3,7 @@ import { Client, Teams } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); diff --git a/src/client.ts b/src/client.ts index 5a30c879..5e9400b2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -344,8 +344,48 @@ class AppwriteException extends Error { /** * Client that handles requests to Appwrite */ -class Client { +type SDKPlatform = 'client' | 'server'; +type ClientAuth = 'browser' | 'session' | 'devKey' | 'impersonation'; +type ServerAuth = 'apiKey' | 'jwt' | 'cookie'; +type Auth = ClientAuth | ServerAuth; +declare const clientAuthBrand: unique symbol; + +// Forces TypeScript to display the expanded shape on hover instead of an alias name. +type Prettify<T> = { [K in keyof T]: T[K] } & {}; + +type BaseClientParams = { + endpoint: string; + endpointRealtime?: string; + selfSigned?: boolean; + projectId: string; + locale?: string; +}; + +type ImpersonationTarget = + | { userId: string; email?: never; phone?: never } + | { email: string; userId?: never; phone?: never } + | { phone: string; userId?: never; email?: never }; + +type LegacyClientSetter = Extract<keyof ClientRuntime<any>, `set${string}`>; +type ClientAuthBuilder = Extract<keyof ClientRuntime<any>, `with${string}`>; +type ClientInternalMethod = LegacyClientSetter | ClientAuthBuilder; +export type Client<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientInternalMethod>; +type LegacyClient<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientAuthBuilder>; + +type ClientConstructor = { + new <TAuth extends Auth = 'browser'>(): LegacyClient<TAuth>; + from(params: Prettify<BaseClientParams>): Client<'browser'>; + fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'>; + fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'>; + fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'>; + fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'>; + fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'>; + fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'>; +}; + +class ClientRuntime<TAuth extends Auth = 'browser'> { static CHUNK_SIZE = 1024 * 1024 * 5; + declare readonly [clientAuthBrand]?: TAuth; /** * Holds configuration such as project. @@ -364,6 +404,7 @@ class Client { impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; + selfSigned: boolean; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', @@ -378,7 +419,11 @@ class Client { impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', + selfSigned: false, }; + + private sdkPlatform: SDKPlatform = 'client'; + /** * Custom headers for API requests. */ @@ -390,6 +435,115 @@ class Client { 'X-Appwrite-Response-Format': '1.9.4', }; + static from(params: Prettify<BaseClientParams>): Client<'browser'> { + return new ClientRuntime<'browser'>().applyBase<'browser'>(params, 'client'); + } + + static fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'> { + const client = new ClientRuntime<'session'>() + .applyBase<'session'>(params, 'client'); + client.headers['X-Appwrite-Session'] = params.session; + client.config.session = params.session; + return client; + } + + static fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'> { + const client = new ClientRuntime<'apiKey'>() + .applyBase<'apiKey'>(params, 'server'); + client.headers['X-Appwrite-Key'] = params.apiKey; + (client.config as unknown as Record<string, string>).key = params.apiKey; + return client; + } + + static fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'> { + const client = new ClientRuntime<'cookie'>() + .applyBase<'cookie'>(params, 'server'); + client.headers['Cookie'] = params.cookie; + client.config.cookie = params.cookie; + return client; + } + + static fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'> { + const client = new ClientRuntime<'jwt'>() + .applyBase<'jwt'>(params, 'server'); + client.headers['X-Appwrite-JWT'] = params.jwt; + client.config.jwt = params.jwt; + return client; + } + + static fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'> { + const client = new ClientRuntime<'devKey'>() + .applyBase<'devKey'>(params, 'client'); + client.headers['X-Appwrite-Dev-Key'] = params.devKey; + client.config.devkey = params.devKey; + return client; + } + + static fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'> { + const targets = [ + params.userId !== undefined, + params.email !== undefined, + params.phone !== undefined + ].filter(Boolean).length; + + if (targets !== 1) { + throw new AppwriteException('Exactly one impersonation target must be provided'); + } + + const client = new ClientRuntime<'impersonation'>() + .applyBase<'impersonation'>(params, 'client'); + + client.headers['X-Appwrite-Session'] = params.session; + client.config.session = params.session; + + if (params.userId !== undefined) { + client.headers['X-Appwrite-Impersonate-User-Id'] = params.userId; + client.config.impersonateuserid = params.userId; + return client; + } + if (params.email !== undefined) { + client.headers['X-Appwrite-Impersonate-User-Email'] = params.email; + client.config.impersonateuseremail = params.email; + return client; + } + client.headers['X-Appwrite-Impersonate-User-Phone'] = params.phone; + client.config.impersonateuserphone = params.phone; + return client; + } + + withJWT(jwt: string): this { + this.headers['X-Appwrite-JWT'] = jwt; + this.config.jwt = jwt; + return this; + } + + withForwardedUserAgent(forwardedUserAgent: string): this { + this.headers['X-Forwarded-User-Agent'] = forwardedUserAgent; + return this; + } + + private applyBase<T extends Auth>(params: BaseClientParams, sdkPlatform: SDKPlatform): ClientRuntime<T> { + const client = this as unknown as ClientRuntime<T>; + client.sdkPlatform = sdkPlatform; + client.headers['x-sdk-platform'] = sdkPlatform === 'server' ? 'server' : 'client'; + client.setEndpoint(params.endpoint); + client.setProject(params.projectId); + + if (params.locale !== undefined) { + client.setLocale(params.locale); + } + + if (params.endpointRealtime !== undefined) { + client.setEndpointRealtime(params.endpointRealtime); + } + + if (params.selfSigned !== undefined) { + client.setSelfSigned(params.selfSigned); + } + + return client; + } + /** * Get Headers * @@ -411,6 +565,9 @@ class Client { * * @returns {this} */ + /** + * @deprecated Use `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, or another static factory instead. + */ setEndpoint(endpoint: string): this { if (!endpoint || typeof endpoint !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -433,6 +590,9 @@ class Client { * * @returns {this} */ + /** + * @deprecated Use the `endpointRealtime` field on a static factory params object instead. + */ setEndpointRealtime(endpointRealtime: string): this { if (!endpointRealtime || typeof endpointRealtime !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -447,158 +607,120 @@ class Client { } /** - * Set Project - * - * Your project ID + * Set self-signed * - * @param value string + * @param {boolean} selfSigned * - * @return {this} + * @returns {this} + */ + /** + * @deprecated Use the `selfSigned` field on a static factory params object instead. + */ + setSelfSigned(selfSigned: boolean): this { + this.config.selfSigned = selfSigned; + return this; + } + + /** + * @deprecated Use a static client factory or factory params object instead. */ setProject(value: string): this { this.headers['X-Appwrite-Project'] = value; this.config.project = value; - return this; + return this as unknown as this; } + /** - * Set Key - * - * Your secret API key - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setKey(value: string): this { + setKey(value: string): ClientRuntime<'apiKey'> { this.headers['X-Appwrite-Key'] = value; this.config.key = value; - return this; + return this as unknown as ClientRuntime<'apiKey'>; } + /** - * Set JWT - * - * Your secret JSON Web Token - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setJWT(value: string): this { + setJWT(value: string): ClientRuntime<'jwt'> { this.headers['X-Appwrite-JWT'] = value; this.config.jwt = value; - return this; + return this as unknown as ClientRuntime<'jwt'>; } + /** - * Set Locale - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ setLocale(value: string): this { this.headers['X-Appwrite-Locale'] = value; this.config.locale = value; - return this; + return this as unknown as this; } + /** - * Set Session - * - * The user session to authenticate with - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setSession(value: string): this { + setSession(value: string): ClientRuntime<'session'> { this.headers['X-Appwrite-Session'] = value; this.config.session = value; - return this; + return this as unknown as ClientRuntime<'session'>; } + /** - * Set ForwardedUserAgent - * - * The user agent string of the client that made the request - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ setForwardedUserAgent(value: string): this { this.headers['X-Forwarded-User-Agent'] = value; this.config.forwardeduseragent = value; - return this; + return this as unknown as this; } + /** - * Set DevKey - * - * Your secret dev API key - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setDevKey(value: string): this { + setDevKey(value: string): ClientRuntime<'devKey'> { this.headers['X-Appwrite-Dev-Key'] = value; this.config.devkey = value; - return this; + return this as unknown as ClientRuntime<'devKey'>; } + /** - * Set Cookie - * - * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setCookie(value: string): this { + setCookie(value: string): ClientRuntime<'cookie'> { this.headers['Cookie'] = value; this.config.cookie = value; - return this; + return this as unknown as ClientRuntime<'cookie'>; } + /** - * Set ImpersonateUserId - * - * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserId(value: string): this { + setImpersonateUserId(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Id'] = value; this.config.impersonateuserid = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + /** - * Set ImpersonateUserEmail - * - * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserEmail(value: string): this { + setImpersonateUserEmail(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Email'] = value; this.config.impersonateuseremail = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + /** - * Set ImpersonateUserPhone - * - * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserPhone(value: string): this { + setImpersonateUserPhone(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Phone'] = value; this.config.impersonateuserphone = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + private realtime: Realtime = { socket: undefined, timeout: undefined, @@ -612,9 +734,13 @@ class Client { lastMessage: undefined, connect: () => { clearTimeout(this.realtime.timeout); - this.realtime.timeout = window?.setTimeout(() => { - this.realtime.createSocket(); - }, 50); + this.realtime.timeout = typeof window !== 'undefined' + ? window.setTimeout(() => { + this.realtime.createSocket(); + }, 50) + : setTimeout(() => { + this.realtime.createSocket(); + }, 50) as unknown as TimeoutHandle; }, getTimeout: () => { switch (true) { @@ -630,14 +756,20 @@ class Client { }, createHeartbeat: () => { if (this.realtime.heartbeat) { - clearTimeout(this.realtime.heartbeat); + clearInterval(this.realtime.heartbeat as any); } - this.realtime.heartbeat = window?.setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000); + this.realtime.heartbeat = typeof window !== 'undefined' + ? window.setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000) + : setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000) as unknown as TimeoutHandle; }, createSocket: () => { if (this.realtime.subscriptions.size < 1) { @@ -723,8 +855,14 @@ class Client { let session = this.config.session; if (!session) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.config.project}`]; + try { + if (typeof window !== 'undefined' && window.localStorage) { + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.config.project}`]; + } + } catch (error) { + console.error('Failed to parse cookie fallback:', error); + } } if (session && !messageData?.user) { this.realtime.socket?.send(JSONbig.stringify(<RealtimeRequest>{ @@ -889,7 +1027,7 @@ class Client { headers = Object.assign({}, this.headers, headers); - if (typeof window !== 'undefined' && window.localStorage) { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage) { const cookieFallback = window.localStorage.getItem('cookieFallback'); if (cookieFallback) { headers['X-Fallback-Cookies'] = cookieFallback; @@ -901,12 +1039,12 @@ class Client { headers, }; - if (headers['X-Appwrite-Dev-Key'] === undefined) { + if (this.sdkPlatform === 'client' && headers['X-Appwrite-Dev-Key'] === undefined) { options.credentials = 'include'; } if (method === 'GET') { - for (const [key, value] of Object.entries(Client.flatten(params))) { + for (const [key, value] of Object.entries(ClientRuntime.flatten(params))) { url.searchParams.append(key, value); } } else { @@ -916,6 +1054,10 @@ class Client { break; case 'multipart/form-data': + if (typeof FormData === 'undefined' || typeof File === 'undefined') { + throw new AppwriteException('Multipart requests require File and FormData globals'); + } + const formData = new FormData(); for (const [key, value] of Object.entries(params)) { @@ -940,13 +1082,17 @@ class Client { } async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { + if (typeof File === 'undefined' || typeof FormData === 'undefined') { + throw new AppwriteException('Chunked uploads require File and FormData globals'); + } + const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? []; if (!file || !fileParam) { throw new Error('File not found in payload'); } - if (file.size <= Client.CHUNK_SIZE) { + if (file.size <= ClientRuntime.CHUNK_SIZE) { return await this.call(method, url, headers, originalPayload); } @@ -954,26 +1100,27 @@ class Client { let response = null; while (start < file.size) { - let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk + let end = start + ClientRuntime.CHUNK_SIZE; // Prepare end for the next chunk if (end >= file.size) { end = file.size; // Adjust for the last chunk to include the last byte } - headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`; + const chunkHeaders = { ...headers }; + chunkHeaders['content-range'] = `bytes ${start}-${end-1}/${file.size}`; const chunk = file.slice(start, end); let payload = { ...originalPayload }; payload[fileParam] = new File([chunk], file.name); - response = await this.call(method, url, headers, payload); + response = await this.call(method, url, chunkHeaders, payload); if (onProgress && typeof onProgress === 'function') { onProgress({ $id: response.$id, progress: Math.round((end / file.size) * 100), sizeUploaded: end, - chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) + chunksTotal: Math.ceil(file.size / ClientRuntime.CHUNK_SIZE), + chunksUploaded: Math.ceil(end / ClientRuntime.CHUNK_SIZE) }); } @@ -999,9 +1146,9 @@ class Client { const response = await fetch(uri, options); // type opaque: No-CORS, different-origin response (CORS-issue) - if (response.type === 'opaque') { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && response.type === 'opaque') { throw new AppwriteException( - `Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, + `Invalid Origin. Register your new client (${typeof window !== 'undefined' ? window.location.host : 'unknown'}) as a new Web platform on your project console dashboard`, 403, "forbidden", "" @@ -1035,7 +1182,7 @@ class Client { const cookieFallback = response.headers.get('X-Fallback-Cookies'); - if (typeof window !== 'undefined' && window.localStorage && cookieFallback) { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage && cookieFallback) { window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); window.localStorage.setItem('cookieFallback', cookieFallback); } @@ -1053,7 +1200,7 @@ class Client { for (const [key, value] of Object.entries(data)) { let finalKey = prefix ? prefix + '[' + key +']' : key; if (Array.isArray(value)) { - output = { ...output, ...Client.flatten(value, finalKey) }; + output = { ...output, ...ClientRuntime.flatten(value, finalKey) }; } else { output[finalKey] = value; } @@ -1063,8 +1210,9 @@ class Client { } } +const Client = ClientRuntime as unknown as ClientConstructor; + export { Client, AppwriteException }; +export type { Models, SDKPlatform, ClientAuth, ServerAuth, Payload, RealtimeResponseEvent, UploadProgress }; export { Query } from './query'; -export type { Models, Payload, UploadProgress }; -export type { RealtimeResponseEvent }; export type { QueryTypes, QueryTypesList } from './query'; diff --git a/src/index.ts b/src/index.ts index cfda66f0..c6c16172 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,7 @@ export { Tokens } from './services/tokens'; export { Users } from './services/users'; export { Webhooks } from './services/webhooks'; export { Realtime } from './services/realtime'; -export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; +export type { Models, Payload, RealtimeResponseEvent, UploadProgress, SDKPlatform, ClientAuth, ServerAuth } from './client'; export type { RealtimeSubscription } from './services/realtime'; export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; diff --git a/src/services/account.ts b/src/services/account.ts index 15e0971f..0994708d 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1,15 +1,25 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { AuthenticatorType } from '../enums/authenticator-type'; import { AuthenticationFactor } from '../enums/authentication-factor'; import { OAuthProvider } from '../enums/o-auth-provider'; -export class Account { - client: Client; +type AccountServerOnlyMethod = never; +type AccountClientOnlyMethod = never; - constructor(client: Client) { +export type Account<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<AccountRuntime<TAuth>, 'client' | AccountServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<AccountRuntime<TAuth>, 'client' | AccountClientOnlyMethod> + : Omit<AccountRuntime<TAuth>, 'client'>; + +class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -2405,8 +2415,8 @@ export class Account { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -2836,3 +2846,9 @@ export class Account { ); } } + +const Account = AccountRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Account<TAuth>; +}; + +export { Account }; diff --git a/src/services/activities.ts b/src/services/activities.ts index bf9a2b45..fa15e6dc 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -1,12 +1,13 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Activities { - client: Client; +export type Activities = Omit<ActivitiesRuntime, 'client'>; - constructor(client: Client) { +class ActivitiesRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -114,3 +115,9 @@ export class Activities { ); } } + +const Activities = ActivitiesRuntime as unknown as { + new (client: Client<ServerAuth>): Activities; +}; + +export { Activities }; diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 66c40fe1..a84754a5 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,5 +1,5 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { Browser } from '../enums/browser'; @@ -10,10 +10,20 @@ import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; -export class Avatars { - client: Client; +type AvatarsServerOnlyMethod = never; +type AvatarsClientOnlyMethod = never; - constructor(client: Client) { +export type Avatars<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsClientOnlyMethod> + : Omit<AvatarsRuntime<TAuth>, 'client'>; + +class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -86,8 +96,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -167,8 +177,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -227,8 +237,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -308,8 +318,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -387,8 +397,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -472,8 +482,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -552,8 +562,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -750,8 +760,8 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -760,3 +770,9 @@ export class Avatars { return uri.toString(); } } + +const Avatars = AvatarsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Avatars<TAuth>; +}; + +export { Avatars }; diff --git a/src/services/backups.ts b/src/services/backups.ts index 99b1fabd..29005f77 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -1,13 +1,14 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { BackupServices } from '../enums/backup-services'; -export class Backups { - client: Client; +export type Backups = Omit<BackupsRuntime, 'client'>; - constructor(client: Client) { +class BackupsRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -752,3 +753,9 @@ export class Backups { ); } } + +const Backups = BackupsRuntime as unknown as { + new (client: Client<ServerAuth>): Backups; +}; + +export { Backups }; diff --git a/src/services/databases.ts b/src/services/databases.ts index a25ed6df..334f3204 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1,5 +1,4 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { RelationshipType } from '../enums/relationship-type'; @@ -7,10 +6,20 @@ import { RelationMutate } from '../enums/relation-mutate'; import { DatabasesIndexType } from '../enums/databases-index-type'; import { OrderBy } from '../enums/order-by'; -export class Databases { - client: Client; +type DatabasesServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listCollections' | 'createCollection' | 'getCollection' | 'updateCollection' | 'deleteCollection' | 'listAttributes' | 'createBigIntAttribute' | 'updateBigIntAttribute' | 'createBooleanAttribute' | 'updateBooleanAttribute' | 'createDatetimeAttribute' | 'updateDatetimeAttribute' | 'createEmailAttribute' | 'updateEmailAttribute' | 'createEnumAttribute' | 'updateEnumAttribute' | 'createFloatAttribute' | 'updateFloatAttribute' | 'createIntegerAttribute' | 'updateIntegerAttribute' | 'createIpAttribute' | 'updateIpAttribute' | 'createLineAttribute' | 'updateLineAttribute' | 'createLongtextAttribute' | 'updateLongtextAttribute' | 'createMediumtextAttribute' | 'updateMediumtextAttribute' | 'createPointAttribute' | 'updatePointAttribute' | 'createPolygonAttribute' | 'updatePolygonAttribute' | 'createRelationshipAttribute' | 'updateRelationshipAttribute' | 'createStringAttribute' | 'updateStringAttribute' | 'createTextAttribute' | 'updateTextAttribute' | 'createUrlAttribute' | 'updateUrlAttribute' | 'createVarcharAttribute' | 'updateVarcharAttribute' | 'getAttribute' | 'deleteAttribute' | 'upsertDocuments' | 'updateDocuments' | 'deleteDocuments' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex'; +type DatabasesClientOnlyMethod = never; - constructor(client: Client) { +export type Databases<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesClientOnlyMethod> + : Omit<DatabasesRuntime<TAuth>, 'client'>; + +class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -24,7 +33,7 @@ export class Databases { * @returns {Promise<Models.DatabaseList>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + list(this: Databases<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -35,7 +44,7 @@ export class Databases { * @returns {Promise<Models.DatabaseList>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list(this: Databases<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; list( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -92,7 +101,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + create(this: Databases<ServerAuth>, params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; /** * Create a new Database. * @@ -104,7 +113,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create(this: Databases<ServerAuth>, databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; create( paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] @@ -498,7 +507,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. */ - get(params: { databaseId: string }): Promise<Models.Database>; + get(this: Databases<ServerAuth>, params: { databaseId: string }): Promise<Models.Database>; /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -507,7 +516,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - get(databaseId: string): Promise<Models.Database>; + get(this: Databases<ServerAuth>, databaseId: string): Promise<Models.Database>; get( paramsOrFirst: { databaseId: string } | string ): Promise<Models.Database> { @@ -552,7 +561,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; + update(this: Databases<ServerAuth>, params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; /** * Update a database by its unique ID. * @@ -563,7 +572,7 @@ export class Databases { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update(this: Databases<ServerAuth>, databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; update( paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] @@ -618,7 +627,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. */ - delete(params: { databaseId: string }): Promise<{}>; + delete(this: Databases<ServerAuth>, params: { databaseId: string }): Promise<{}>; /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -627,7 +636,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - delete(databaseId: string): Promise<{}>; + delete(this: Databases<ServerAuth>, databaseId: string): Promise<{}>; delete( paramsOrFirst: { databaseId: string } | string ): Promise<{}> { @@ -674,7 +683,7 @@ export class Databases { * @returns {Promise<Models.CollectionList>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. */ - listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; + listCollections(this: Databases<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -686,7 +695,7 @@ export class Databases { * @returns {Promise<Models.CollectionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; + listCollections(this: Databases<ServerAuth>, databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; listCollections( paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, ...rest: [(string[])?, (string)?, (boolean)?] @@ -752,7 +761,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. */ - createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; + createCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; /** * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * @@ -768,7 +777,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated Use the object parameter style method for a better developer experience. */ - createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; + createCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; createCollection( paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] @@ -855,7 +864,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. */ - getCollection(params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; + getCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; /** * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * @@ -865,7 +874,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated Use the object parameter style method for a better developer experience. */ - getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>; + getCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string): Promise<Models.Collection>; getCollection( paramsOrFirst: { databaseId: string, collectionId: string } | string, ...rest: [(string)?] @@ -920,7 +929,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. */ - updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; + updateCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; /** * Update a collection by its unique ID. * @@ -935,7 +944,7 @@ export class Databases { * @returns {Promise<Models.Collection>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; + updateCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; updateCollection( paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] @@ -1011,7 +1020,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. */ - deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; + deleteCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string }): Promise<{}>; /** * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * @@ -1021,7 +1030,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteCollection(databaseId: string, collectionId: string): Promise<{}>; + deleteCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string): Promise<{}>; deleteCollection( paramsOrFirst: { databaseId: string, collectionId: string } | string, ...rest: [(string)?] @@ -1074,7 +1083,7 @@ export class Databases { * @returns {Promise<Models.AttributeList>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. */ - listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; + listAttributes(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; /** * List attributes in the collection. * @@ -1086,7 +1095,7 @@ export class Databases { * @returns {Promise<Models.AttributeList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; + listAttributes(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; listAttributes( paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?] @@ -1153,7 +1162,7 @@ export class Databases { * @returns {Promise<Models.AttributeBigint>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead. */ - createBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; + createBigIntAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; /** * Create a bigint attribute. Optionally, minimum and maximum values can be provided. * @@ -1170,7 +1179,7 @@ export class Databases { * @returns {Promise<Models.AttributeBigint>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; + createBigIntAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; createBigIntAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] @@ -1264,7 +1273,7 @@ export class Databases { * @returns {Promise<Models.AttributeBigint>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead. */ - updateBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; + updateBigIntAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; /** * Update a bigint attribute. Changing the `default` value will not update already existing documents. * @@ -1281,7 +1290,7 @@ export class Databases { * @returns {Promise<Models.AttributeBigint>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; + updateBigIntAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; updateBigIntAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] @@ -1373,7 +1382,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. */ - createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; + createBooleanAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; /** * Create a boolean attribute. * @@ -1388,7 +1397,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; + createBooleanAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; createBooleanAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] @@ -1469,7 +1478,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. */ - updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; + updateBooleanAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; /** * Update a boolean attribute. Changing the `default` value will not update already existing documents. * @@ -1483,7 +1492,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; + updateBooleanAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; updateBooleanAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] @@ -1564,7 +1573,7 @@ export class Databases { * @returns {Promise<Models.AttributeDatetime>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. */ - createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; + createDatetimeAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; /** * Create a date time attribute according to the ISO 8601 standard. * @@ -1578,7 +1587,7 @@ export class Databases { * @returns {Promise<Models.AttributeDatetime>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; + createDatetimeAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; createDatetimeAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -1659,7 +1668,7 @@ export class Databases { * @returns {Promise<Models.AttributeDatetime>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. */ - updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; + updateDatetimeAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; /** * Update a date time attribute. Changing the `default` value will not update already existing documents. * @@ -1673,7 +1682,7 @@ export class Databases { * @returns {Promise<Models.AttributeDatetime>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; + updateDatetimeAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; updateDatetimeAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -1755,7 +1764,7 @@ export class Databases { * @returns {Promise<Models.AttributeEmail>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. */ - createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; + createEmailAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; /** * Create an email attribute. * @@ -1770,7 +1779,7 @@ export class Databases { * @returns {Promise<Models.AttributeEmail>} * @deprecated Use the object parameter style method for a better developer experience. */ - createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; + createEmailAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; createEmailAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -1852,7 +1861,7 @@ export class Databases { * @returns {Promise<Models.AttributeEmail>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. */ - updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; + updateEmailAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; /** * Update an email attribute. Changing the `default` value will not update already existing documents. * @@ -1867,7 +1876,7 @@ export class Databases { * @returns {Promise<Models.AttributeEmail>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; + updateEmailAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; updateEmailAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -1950,7 +1959,7 @@ export class Databases { * @returns {Promise<Models.AttributeEnum>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. */ - createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; + createEnumAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; /** * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. * @@ -1966,7 +1975,7 @@ export class Databases { * @returns {Promise<Models.AttributeEnum>} * @deprecated Use the object parameter style method for a better developer experience. */ - createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; + createEnumAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; createEnumAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] @@ -2057,7 +2066,7 @@ export class Databases { * @returns {Promise<Models.AttributeEnum>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. */ - updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; + updateEnumAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; /** * Update an enum attribute. Changing the `default` value will not update already existing documents. * @@ -2073,7 +2082,7 @@ export class Databases { * @returns {Promise<Models.AttributeEnum>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; + updateEnumAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; updateEnumAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] @@ -2165,7 +2174,7 @@ export class Databases { * @returns {Promise<Models.AttributeFloat>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. */ - createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; + createFloatAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; /** * Create a float attribute. Optionally, minimum and maximum values can be provided. * @@ -2182,7 +2191,7 @@ export class Databases { * @returns {Promise<Models.AttributeFloat>} * @deprecated Use the object parameter style method for a better developer experience. */ - createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; + createFloatAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; createFloatAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] @@ -2276,7 +2285,7 @@ export class Databases { * @returns {Promise<Models.AttributeFloat>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. */ - updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; + updateFloatAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; /** * Update a float attribute. Changing the `default` value will not update already existing documents. * @@ -2293,7 +2302,7 @@ export class Databases { * @returns {Promise<Models.AttributeFloat>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; + updateFloatAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; updateFloatAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] @@ -2387,7 +2396,7 @@ export class Databases { * @returns {Promise<Models.AttributeInteger>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. */ - createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; + createIntegerAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. * @@ -2404,7 +2413,7 @@ export class Databases { * @returns {Promise<Models.AttributeInteger>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; + createIntegerAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; createIntegerAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] @@ -2498,7 +2507,7 @@ export class Databases { * @returns {Promise<Models.AttributeInteger>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. */ - updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; + updateIntegerAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; /** * Update an integer attribute. Changing the `default` value will not update already existing documents. * @@ -2515,7 +2524,7 @@ export class Databases { * @returns {Promise<Models.AttributeInteger>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; + updateIntegerAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; updateIntegerAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] @@ -2607,7 +2616,7 @@ export class Databases { * @returns {Promise<Models.AttributeIp>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. */ - createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; + createIpAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; /** * Create IP address attribute. * @@ -2622,7 +2631,7 @@ export class Databases { * @returns {Promise<Models.AttributeIp>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; + createIpAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; createIpAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -2704,7 +2713,7 @@ export class Databases { * @returns {Promise<Models.AttributeIp>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. */ - updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; + updateIpAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; /** * Update an ip attribute. Changing the `default` value will not update already existing documents. * @@ -2719,7 +2728,7 @@ export class Databases { * @returns {Promise<Models.AttributeIp>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; + updateIpAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; updateIpAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -2799,7 +2808,7 @@ export class Databases { * @returns {Promise<Models.AttributeLine>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. */ - createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; + createLineAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; /** * Create a geometric line attribute. * @@ -2812,7 +2821,7 @@ export class Databases { * @returns {Promise<Models.AttributeLine>} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; + createLineAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; createLineAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -2888,7 +2897,7 @@ export class Databases { * @returns {Promise<Models.AttributeLine>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. */ - updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; + updateLineAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; /** * Update a line attribute. Changing the `default` value will not update already existing documents. * @@ -2902,7 +2911,7 @@ export class Databases { * @returns {Promise<Models.AttributeLine>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; + updateLineAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; updateLineAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -2981,7 +2990,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeLongtext>} */ - createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; + createLongtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; /** * Create a longtext attribute. * @@ -2997,7 +3006,7 @@ export class Databases { * @returns {Promise<Models.AttributeLongtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; + createLongtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; createLongtextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -3083,7 +3092,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeLongtext>} */ - updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; + updateLongtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; /** * Update a longtext attribute. Changing the `default` value will not update already existing documents. * @@ -3098,7 +3107,7 @@ export class Databases { * @returns {Promise<Models.AttributeLongtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; + updateLongtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; updateLongtextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -3180,7 +3189,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeMediumtext>} */ - createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; + createMediumtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; /** * Create a mediumtext attribute. * @@ -3196,7 +3205,7 @@ export class Databases { * @returns {Promise<Models.AttributeMediumtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; + createMediumtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; createMediumtextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -3282,7 +3291,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeMediumtext>} */ - updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; + updateMediumtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; /** * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. * @@ -3297,7 +3306,7 @@ export class Databases { * @returns {Promise<Models.AttributeMediumtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; + updateMediumtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; updateMediumtextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -3377,7 +3386,7 @@ export class Databases { * @returns {Promise<Models.AttributePoint>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. */ - createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; + createPointAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; /** * Create a geometric point attribute. * @@ -3390,7 +3399,7 @@ export class Databases { * @returns {Promise<Models.AttributePoint>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; + createPointAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; createPointAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -3466,7 +3475,7 @@ export class Databases { * @returns {Promise<Models.AttributePoint>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. */ - updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; + updatePointAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; /** * Update a point attribute. Changing the `default` value will not update already existing documents. * @@ -3480,7 +3489,7 @@ export class Databases { * @returns {Promise<Models.AttributePoint>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; + updatePointAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; updatePointAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -3557,7 +3566,7 @@ export class Databases { * @returns {Promise<Models.AttributePolygon>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. */ - createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; + createPolygonAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; /** * Create a geometric polygon attribute. * @@ -3570,7 +3579,7 @@ export class Databases { * @returns {Promise<Models.AttributePolygon>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; + createPolygonAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; createPolygonAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -3646,7 +3655,7 @@ export class Databases { * @returns {Promise<Models.AttributePolygon>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. */ - updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; + updatePolygonAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; /** * Update a polygon attribute. Changing the `default` value will not update already existing documents. * @@ -3660,7 +3669,7 @@ export class Databases { * @returns {Promise<Models.AttributePolygon>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; + updatePolygonAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; updatePolygonAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -3741,7 +3750,7 @@ export class Databases { * @returns {Promise<Models.AttributeRelationship>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. */ - createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; + createRelationshipAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -3758,7 +3767,7 @@ export class Databases { * @returns {Promise<Models.AttributeRelationship>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; + createRelationshipAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; createRelationshipAttribute( paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] @@ -3849,7 +3858,7 @@ export class Databases { * @returns {Promise<Models.AttributeRelationship>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; + updateRelationshipAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; /** * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -3863,7 +3872,7 @@ export class Databases { * @returns {Promise<Models.AttributeRelationship>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; + updateRelationshipAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; updateRelationshipAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] @@ -3936,7 +3945,7 @@ export class Databases { * @returns {Promise<Models.AttributeString>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. */ - createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; + createStringAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; /** * Create a string attribute. * @@ -3953,7 +3962,7 @@ export class Databases { * @returns {Promise<Models.AttributeString>} * @deprecated Use the object parameter style method for a better developer experience. */ - createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; + createStringAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; createStringAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -4049,7 +4058,7 @@ export class Databases { * @returns {Promise<Models.AttributeString>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. */ - updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; + updateStringAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; /** * Update a string attribute. Changing the `default` value will not update already existing documents. * @@ -4065,7 +4074,7 @@ export class Databases { * @returns {Promise<Models.AttributeString>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; + updateStringAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; updateStringAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] @@ -4152,7 +4161,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeText>} */ - createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; + createTextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; /** * Create a text attribute. * @@ -4168,7 +4177,7 @@ export class Databases { * @returns {Promise<Models.AttributeText>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; + createTextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; createTextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -4254,7 +4263,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeText>} */ - updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; + updateTextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; /** * Update a text attribute. Changing the `default` value will not update already existing documents. * @@ -4269,7 +4278,7 @@ export class Databases { * @returns {Promise<Models.AttributeText>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; + updateTextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; updateTextAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -4351,7 +4360,7 @@ export class Databases { * @returns {Promise<Models.AttributeUrl>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. */ - createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; + createUrlAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; /** * Create a URL attribute. * @@ -4366,7 +4375,7 @@ export class Databases { * @returns {Promise<Models.AttributeUrl>} * @deprecated Use the object parameter style method for a better developer experience. */ - createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; + createUrlAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; createUrlAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -4448,7 +4457,7 @@ export class Databases { * @returns {Promise<Models.AttributeUrl>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. */ - updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; + updateUrlAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; /** * Update an url attribute. Changing the `default` value will not update already existing documents. * @@ -4463,7 +4472,7 @@ export class Databases { * @returns {Promise<Models.AttributeUrl>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; + updateUrlAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; updateUrlAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -4546,7 +4555,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeVarchar>} */ - createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; + createVarcharAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; /** * Create a varchar attribute. * @@ -4563,7 +4572,7 @@ export class Databases { * @returns {Promise<Models.AttributeVarchar>} * @deprecated Use the object parameter style method for a better developer experience. */ - createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; + createVarcharAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; createVarcharAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -4658,7 +4667,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<Models.AttributeVarchar>} */ - updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; + updateVarcharAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; /** * Update a varchar attribute. Changing the `default` value will not update already existing documents. * @@ -4674,7 +4683,7 @@ export class Databases { * @returns {Promise<Models.AttributeVarchar>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVarcharAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; + updateVarcharAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; updateVarcharAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] @@ -4757,7 +4766,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. */ - getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + getAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; /** * Get attribute by ID. * @@ -4768,7 +4777,7 @@ export class Databases { * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} * @deprecated Use the object parameter style method for a better developer experience. */ - getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + getAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; getAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -4824,7 +4833,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. */ - deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + deleteAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; /** * Deletes an attribute. * @@ -4835,7 +4844,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<{}>; deleteAttribute( paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -5155,7 +5164,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; /** * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * @@ -5168,7 +5177,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; upsertDocuments<Document extends Models.Document = Models.DefaultDocument>( paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, ...rest: [(string)?, (object[])?, (string)?] @@ -5235,7 +5244,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; /** * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. * @@ -5248,7 +5257,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; updateDocuments<Document extends Models.Document = Models.DefaultDocument>( paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, ...rest: [(string)?, (object)?, (string[])?, (string)?] @@ -5316,7 +5325,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; /** * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * @@ -5328,7 +5337,7 @@ export class Databases { * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; deleteDocuments<Document extends Models.Document = Models.DefaultDocument>( paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, ...rest: [(string)?, (string[])?, (string)?] @@ -5917,7 +5926,7 @@ export class Databases { * @returns {Promise<Models.IndexList>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. */ - listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; + listIndexes(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; /** * List indexes in the collection. * @@ -5929,7 +5938,7 @@ export class Databases { * @returns {Promise<Models.IndexList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; + listIndexes(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; listIndexes( paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?] @@ -5995,7 +6004,7 @@ export class Databases { * @returns {Promise<Models.Index>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. */ - createIndex(params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; + createIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; /** * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. * Attributes can be `key`, `fulltext`, and `unique`. @@ -6011,7 +6020,7 @@ export class Databases { * @returns {Promise<Models.Index>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIndex(databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; + createIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; createIndex( paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] @@ -6097,7 +6106,7 @@ export class Databases { * @returns {Promise<Models.Index>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. */ - getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; + getIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; /** * Get an index by its unique ID. * @@ -6108,7 +6117,7 @@ export class Databases { * @returns {Promise<Models.Index>} * @deprecated Use the object parameter style method for a better developer experience. */ - getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>; + getIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<Models.Index>; getIndex( paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -6164,7 +6173,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. */ - deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + deleteIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; /** * Delete an index. * @@ -6175,7 +6184,7 @@ export class Databases { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<{}>; deleteIndex( paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -6222,3 +6231,9 @@ export class Databases { ); } } + +const Databases = DatabasesRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Databases<TAuth>; +}; + +export { Databases }; diff --git a/src/services/functions.ts b/src/services/functions.ts index 7ab63a5e..ff6e7aa9 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1,5 +1,5 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { Runtime } from '../enums/runtime'; @@ -9,10 +9,20 @@ import { VCSReferenceType } from '../enums/vcs-reference-type'; import { DeploymentDownloadType } from '../enums/deployment-download-type'; import { ExecutionMethod } from '../enums/execution-method'; -export class Functions { - client: Client; +type FunctionsServerOnlyMethod = 'list' | 'create' | 'listRuntimes' | 'listSpecifications' | 'get' | 'update' | 'delete' | 'updateFunctionDeployment' | 'listDeployments' | 'createDeployment' | 'createDuplicateDeployment' | 'createTemplateDeployment' | 'createVcsDeployment' | 'getDeployment' | 'deleteDeployment' | 'getDeploymentDownload' | 'updateDeploymentStatus' | 'deleteExecution' | 'listVariables' | 'createVariable' | 'getVariable' | 'updateVariable' | 'deleteVariable'; +type FunctionsClientOnlyMethod = never; - constructor(client: Client) { +export type Functions<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsClientOnlyMethod> + : Omit<FunctionsRuntime<TAuth>, 'client'>; + +class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -25,7 +35,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.FunctionList>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; + list(this: Functions<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; /** * Get a list of all the project's functions. You can use the query params to filter your results. * @@ -36,7 +46,7 @@ export class Functions { * @returns {Promise<Models.FunctionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; + list(this: Functions<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; list( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -108,7 +118,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + create(this: Functions<ServerAuth>, params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * @@ -136,7 +146,7 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + create(this: Functions<ServerAuth>, functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; create( paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] @@ -283,6 +293,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.RuntimeList>} */ + listRuntimes(this: Functions<ServerAuth>, ): Promise<Models.RuntimeList>; listRuntimes(): Promise<Models.RuntimeList> { const apiPath = '/functions/runtimes'; @@ -306,6 +317,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.SpecificationList>} */ + listSpecifications(this: Functions<ServerAuth>, ): Promise<Models.SpecificationList>; listSpecifications(): Promise<Models.SpecificationList> { const apiPath = '/functions/specifications'; @@ -330,7 +342,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - get(params: { functionId: string }): Promise<Models.Function>; + get(this: Functions<ServerAuth>, params: { functionId: string }): Promise<Models.Function>; /** * Get a function by its unique ID. * @@ -339,7 +351,7 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - get(functionId: string): Promise<Models.Function>; + get(this: Functions<ServerAuth>, functionId: string): Promise<Models.Function>; get( paramsOrFirst: { functionId: string } | string ): Promise<Models.Function> { @@ -400,7 +412,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + update(this: Functions<ServerAuth>, params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; /** * Update function by its unique ID. * @@ -428,7 +440,7 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + update(this: Functions<ServerAuth>, functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; update( paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] @@ -570,7 +582,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { functionId: string }): Promise<{}>; + delete(this: Functions<ServerAuth>, params: { functionId: string }): Promise<{}>; /** * Delete a function by its unique ID. * @@ -579,7 +591,7 @@ export class Functions { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - delete(functionId: string): Promise<{}>; + delete(this: Functions<ServerAuth>, functionId: string): Promise<{}>; delete( paramsOrFirst: { functionId: string } | string ): Promise<{}> { @@ -623,7 +635,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Function>; + updateFunctionDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Function>; /** * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. * @@ -633,7 +645,7 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFunctionDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; + updateFunctionDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Function>; updateFunctionDeployment( paramsOrFirst: { functionId: string, deploymentId: string } | string, ...rest: [(string)?] @@ -688,7 +700,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.DeploymentList>} */ - listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; + listDeployments(this: Functions<ServerAuth>, params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * @@ -700,7 +712,7 @@ export class Functions { * @returns {Promise<Models.DeploymentList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; + listDeployments(this: Functions<ServerAuth>, functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; listDeployments( paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, ...rest: [(string[])?, (string)?, (boolean)?] @@ -766,7 +778,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - createDeployment(params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; + createDeployment(this: Functions<ServerAuth>, params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; /** * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. * @@ -783,7 +795,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment(this: Functions<ServerAuth>, functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; createDeployment( paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] @@ -859,7 +871,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; + createDuplicateDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; /** * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * @@ -870,7 +882,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; + createDuplicateDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; createDuplicateDeployment( paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, ...rest: [(string)?, (string)?] @@ -935,7 +947,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + createTemplateDeployment(this: Functions<ServerAuth>, params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; /** * Create a deployment based on a template. * @@ -952,7 +964,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createTemplateDeployment(this: Functions<ServerAuth>, functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; createTemplateDeployment( paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] @@ -1046,7 +1058,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + createVcsDeployment(this: Functions<ServerAuth>, params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; /** * Create a deployment when a function is connected to VCS. * @@ -1060,7 +1072,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createVcsDeployment(this: Functions<ServerAuth>, functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; createVcsDeployment( paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] @@ -1126,7 +1138,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - getDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + getDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; /** * Get a function deployment by its unique ID. * @@ -1136,7 +1148,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; + getDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Deployment>; getDeployment( paramsOrFirst: { functionId: string, deploymentId: string } | string, ...rest: [(string)?] @@ -1185,7 +1197,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; + deleteDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<{}>; /** * Delete a code deployment by its unique ID. * @@ -1195,7 +1207,7 @@ export class Functions { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; + deleteDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<{}>; deleteDeployment( paramsOrFirst: { functionId: string, deploymentId: string } | string, ...rest: [(string)?] @@ -1246,7 +1258,7 @@ export class Functions { * @throws {AppwriteException} * @returns {string} */ - getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + getDeploymentDownload(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; /** * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -1257,7 +1269,7 @@ export class Functions { * @returns {string} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload(this: Functions<ServerAuth>, functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; getDeploymentDownload( paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, ...rest: [(string)?, (DeploymentDownloadType)?] @@ -1295,8 +1307,8 @@ export class Functions { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['key'] = this.client.config.key; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1313,7 +1325,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Deployment>} */ - updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + updateDeploymentStatus(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; /** * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * @@ -1323,7 +1335,7 @@ export class Functions { * @returns {Promise<Models.Deployment>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>; + updateDeploymentStatus(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Deployment>; updateDeploymentStatus( paramsOrFirst: { functionId: string, deploymentId: string } | string, ...rest: [(string)?] @@ -1593,7 +1605,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; + deleteExecution(this: Functions<ServerAuth>, params: { functionId: string, executionId: string }): Promise<{}>; /** * Delete a function execution by its unique ID. * @@ -1603,7 +1615,7 @@ export class Functions { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteExecution(functionId: string, executionId: string): Promise<{}>; + deleteExecution(this: Functions<ServerAuth>, functionId: string, executionId: string): Promise<{}>; deleteExecution( paramsOrFirst: { functionId: string, executionId: string } | string, ...rest: [(string)?] @@ -1654,7 +1666,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.VariableList>} */ - listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + listVariables(this: Functions<ServerAuth>, params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; /** * Get a list of all variables of a specific function. * @@ -1665,7 +1677,7 @@ export class Functions { * @returns {Promise<Models.VariableList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables(this: Functions<ServerAuth>, functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; listVariables( paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -1722,7 +1734,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Variable>} */ - createVariable(params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + createVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; /** * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * @@ -1735,7 +1747,7 @@ export class Functions { * @returns {Promise<Models.Variable>} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable(this: Functions<ServerAuth>, functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; createVariable( paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (boolean)?] @@ -1809,7 +1821,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Variable>} */ - getVariable(params: { functionId: string, variableId: string }): Promise<Models.Variable>; + getVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<Models.Variable>; /** * Get a variable by its unique ID. * @@ -1819,7 +1831,7 @@ export class Functions { * @returns {Promise<Models.Variable>} * @deprecated Use the object parameter style method for a better developer experience. */ - getVariable(functionId: string, variableId: string): Promise<Models.Variable>; + getVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<Models.Variable>; getVariable( paramsOrFirst: { functionId: string, variableId: string } | string, ...rest: [(string)?] @@ -1871,7 +1883,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Variable>} */ - updateVariable(params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + updateVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; /** * Update variable by its unique ID. * @@ -1884,7 +1896,7 @@ export class Functions { * @returns {Promise<Models.Variable>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVariable(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable(this: Functions<ServerAuth>, functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; updateVariable( paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (boolean)?] @@ -1949,7 +1961,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; + deleteVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<{}>; /** * Delete a variable by its unique ID. * @@ -1959,7 +1971,7 @@ export class Functions { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteVariable(functionId: string, variableId: string): Promise<{}>; + deleteVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<{}>; deleteVariable( paramsOrFirst: { functionId: string, variableId: string } | string, ...rest: [(string)?] @@ -2001,3 +2013,9 @@ export class Functions { ); } } + +const Functions = FunctionsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Functions<TAuth>; +}; + +export { Functions }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index e995f66e..5068c21d 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Graphql { - client: Client; +type GraphqlServerOnlyMethod = never; +type GraphqlClientOnlyMethod = never; - constructor(client: Client) { +export type Graphql<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlClientOnlyMethod> + : Omit<GraphqlRuntime<TAuth>, 'client'>; + +class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -122,3 +131,9 @@ export class Graphql { ); } } + +const Graphql = GraphqlRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Graphql<TAuth>; +}; + +export { Graphql }; diff --git a/src/services/health.ts b/src/services/health.ts index 259b4e98..32578a39 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -1,13 +1,14 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { Name } from '../enums/name'; -export class Health { - client: Client; +export type Health = Omit<HealthRuntime, 'client'>; - constructor(client: Client) { +class HealthRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -1041,3 +1042,9 @@ export class Health { ); } } + +const Health = HealthRuntime as unknown as { + new (client: Client<ServerAuth>): Health; +}; + +export { Health }; diff --git a/src/services/locale.ts b/src/services/locale.ts index fe85eeb5..c9a0b95f 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Locale { - client: Client; +type LocaleServerOnlyMethod = never; +type LocaleClientOnlyMethod = never; - constructor(client: Client) { +export type Locale<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleClientOnlyMethod> + : Omit<LocaleRuntime<TAuth>, 'client'>; + +class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -196,3 +205,9 @@ export class Locale { ); } } + +const Locale = LocaleRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Locale<TAuth>; +}; + +export { Locale }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 89c754fd..35acc289 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -1,14 +1,23 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { MessagePriority } from '../enums/message-priority'; import { SmtpEncryption } from '../enums/smtp-encryption'; -export class Messaging { - client: Client; +type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'createSMS' | 'updateSms' | 'updateSMS' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'createAPNSProvider' | 'updateApnsProvider' | 'updateAPNSProvider' | 'createFcmProvider' | 'createFCMProvider' | 'updateFcmProvider' | 'updateFCMProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'createSMTPProvider' | 'updateSmtpProvider' | 'updateSMTPProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; +type MessagingClientOnlyMethod = never; - constructor(client: Client) { +export type Messaging<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingClientOnlyMethod> + : Omit<MessagingRuntime<TAuth>, 'client'>; + +class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -21,7 +30,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.MessageList>} */ - listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; + listMessages(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; /** * Get a list of all messages from the current Appwrite project. * @@ -32,7 +41,7 @@ export class Messaging { * @returns {Promise<Models.MessageList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listMessages(queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; + listMessages(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; listMessages( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -96,7 +105,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; + createEmail(this: Messaging<ServerAuth>, params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; /** * Create a new email message. * @@ -116,7 +125,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; + createEmail(this: Messaging<ServerAuth>, messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; createEmail( paramsOrFirst: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string } | string, ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (boolean)?, (boolean)?, (string)?] @@ -236,7 +245,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; + updateEmail(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; /** * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * @@ -257,7 +266,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; + updateEmail(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; updateEmail( paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] } | string, ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (boolean)?, (string[])?, (string[])?, (string)?, (string[])?] @@ -374,7 +383,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + createPush(this: Messaging<ServerAuth>, params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; /** * Create a new push notification. * @@ -401,7 +410,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + createPush(this: Messaging<ServerAuth>, messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; createPush( paramsOrFirst: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] @@ -557,7 +566,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + updatePush(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; /** * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * @@ -585,7 +594,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + updatePush(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; updatePush( paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] @@ -726,7 +735,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. */ - createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + createSms(this: Messaging<ServerAuth>, params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; /** * Create a new SMS message. * @@ -741,7 +750,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSms(this: Messaging<ServerAuth>, messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; createSms( paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] @@ -827,7 +836,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + createSMS(this: Messaging<ServerAuth>, params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; /** * Create a new SMS message. * @@ -842,7 +851,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSMS(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSMS(this: Messaging<ServerAuth>, messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; createSMS( paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] @@ -930,7 +939,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. */ - updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + updateSms(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; /** * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * @@ -946,7 +955,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSms(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; updateSms( paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] @@ -1027,7 +1036,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + updateSMS(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; /** * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * @@ -1043,7 +1052,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSMS(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSMS(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; updateSMS( paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] @@ -1118,7 +1127,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ - getMessage(params: { messageId: string }): Promise<Models.Message>; + getMessage(this: Messaging<ServerAuth>, params: { messageId: string }): Promise<Models.Message>; /** * Get a message by its unique ID. * @@ -1128,7 +1137,7 @@ export class Messaging { * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ - getMessage(messageId: string): Promise<Models.Message>; + getMessage(this: Messaging<ServerAuth>, messageId: string): Promise<Models.Message>; getMessage( paramsOrFirst: { messageId: string } | string ): Promise<Models.Message> { @@ -1170,7 +1179,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { messageId: string }): Promise<{}>; + delete(this: Messaging<ServerAuth>, params: { messageId: string }): Promise<{}>; /** * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. * @@ -1179,7 +1188,7 @@ export class Messaging { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - delete(messageId: string): Promise<{}>; + delete(this: Messaging<ServerAuth>, messageId: string): Promise<{}>; delete( paramsOrFirst: { messageId: string } | string ): Promise<{}> { @@ -1224,7 +1233,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.LogList>} */ - listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + listMessageLogs(this: Messaging<ServerAuth>, params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; /** * Get the message activity logs listed by its unique ID. * @@ -1235,7 +1244,7 @@ export class Messaging { * @returns {Promise<Models.LogList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listMessageLogs(this: Messaging<ServerAuth>, messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; listMessageLogs( paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -1290,7 +1299,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.TargetList>} */ - listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; + listTargets(this: Messaging<ServerAuth>, params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; /** * Get a list of the targets associated with a message. * @@ -1301,7 +1310,7 @@ export class Messaging { * @returns {Promise<Models.TargetList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTargets(messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; + listTargets(this: Messaging<ServerAuth>, messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; listTargets( paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -1356,7 +1365,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.ProviderList>} */ - listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; + listProviders(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; /** * Get a list of all providers from the current Appwrite project. * @@ -1367,7 +1376,7 @@ export class Messaging { * @returns {Promise<Models.ProviderList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listProviders(queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; + listProviders(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; listProviders( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -1428,7 +1437,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. */ - createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + createApnsProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Apple Push Notification service provider. * @@ -1444,7 +1453,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createApnsProvider(this: Messaging<ServerAuth>, providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; createApnsProvider( paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] @@ -1536,7 +1545,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + createAPNSProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Apple Push Notification service provider. * @@ -1552,7 +1561,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createAPNSProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createAPNSProvider(this: Messaging<ServerAuth>, providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; createAPNSProvider( paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] @@ -1645,7 +1654,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. */ - updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + updateApnsProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1661,7 +1670,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateApnsProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; updateApnsProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -1747,7 +1756,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + updateAPNSProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1763,7 +1772,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateAPNSProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateAPNSProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; updateAPNSProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -1846,7 +1855,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. */ - createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + createFcmProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Firebase Cloud Messaging provider. * @@ -1858,7 +1867,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFcmProvider(this: Messaging<ServerAuth>, providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; createFcmProvider( paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, ...rest: [(string)?, (object)?, (boolean)?] @@ -1926,7 +1935,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + createFCMProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Firebase Cloud Messaging provider. * @@ -1938,7 +1947,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFCMProvider(this: Messaging<ServerAuth>, providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; createFCMProvider( paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, ...rest: [(string)?, (object)?, (boolean)?] @@ -2007,7 +2016,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. */ - updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + updateFcmProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -2019,7 +2028,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFcmProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; updateFcmProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, ...rest: [(string)?, (boolean)?, (object)?] @@ -2081,7 +2090,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + updateFCMProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -2093,7 +2102,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFCMProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFCMProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; updateFCMProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, ...rest: [(string)?, (boolean)?, (object)?] @@ -2161,7 +2170,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createMailgunProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Mailgun provider. * @@ -2179,7 +2188,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createMailgunProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; createMailgunProvider( paramsOrFirst: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -2283,7 +2292,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + updateMailgunProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; /** * Update a Mailgun provider by its unique ID. * @@ -2301,7 +2310,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateMailgunProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; updateMailgunProvider( paramsOrFirst: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, ...rest: [(string)?, (string)?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] @@ -2395,7 +2404,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; + createMsg91Provider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new MSG91 provider. * @@ -2409,7 +2418,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; + createMsg91Provider(this: Messaging<ServerAuth>, providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; createMsg91Provider( paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -2489,7 +2498,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; + updateMsg91Provider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; /** * Update a MSG91 provider by its unique ID. * @@ -2503,7 +2512,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; + updateMsg91Provider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; updateMsg91Provider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] @@ -2579,7 +2588,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createResendProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Resend provider. * @@ -2595,7 +2604,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createResendProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createResendProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; createResendProvider( paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -2687,7 +2696,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + updateResendProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; /** * Update a Resend provider by its unique ID. * @@ -2703,7 +2712,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateResendProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateResendProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; updateResendProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] @@ -2789,7 +2798,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Sendgrid provider. * @@ -2805,7 +2814,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSendgridProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; createSendgridProvider( paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -2897,7 +2906,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + updateSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; /** * Update a Sendgrid provider by its unique ID. * @@ -2913,7 +2922,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateSendgridProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; updateSendgridProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] @@ -3006,7 +3015,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. */ - createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createSmtpProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new SMTP provider. * @@ -3028,7 +3037,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSmtpProvider(this: Messaging<ServerAuth>, providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; createSmtpProvider( paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3159,7 +3168,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createSMTPProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new SMTP provider. * @@ -3181,7 +3190,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSMTPProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSMTPProvider(this: Messaging<ServerAuth>, providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; createSMTPProvider( paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3313,7 +3322,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. */ - updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + updateSmtpProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Update a SMTP provider by its unique ID. * @@ -3335,7 +3344,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSmtpProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; updateSmtpProvider( paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3457,7 +3466,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + updateSMTPProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Update a SMTP provider by its unique ID. * @@ -3479,7 +3488,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSMTPProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSMTPProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; updateSMTPProvider( paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3593,7 +3602,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + createTelesignProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Telesign provider. * @@ -3607,7 +3616,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTelesignProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; createTelesignProvider( paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3687,7 +3696,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + updateTelesignProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; /** * Update a Telesign provider by its unique ID. * @@ -3701,7 +3710,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTelesignProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; updateTelesignProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] @@ -3775,7 +3784,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + createTextmagicProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Textmagic provider. * @@ -3789,7 +3798,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTextmagicProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; createTextmagicProvider( paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -3869,7 +3878,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + updateTextmagicProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; /** * Update a Textmagic provider by its unique ID. * @@ -3883,7 +3892,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTextmagicProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; updateTextmagicProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] @@ -3957,7 +3966,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; + createTwilioProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Twilio provider. * @@ -3971,7 +3980,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; + createTwilioProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; createTwilioProvider( paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -4051,7 +4060,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; + updateTwilioProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; /** * Update a Twilio provider by its unique ID. * @@ -4065,7 +4074,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; + updateTwilioProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; updateTwilioProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] @@ -4139,7 +4148,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; + createVonageProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; /** * Create a new Vonage provider. * @@ -4153,7 +4162,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; + createVonageProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; createVonageProvider( paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] @@ -4233,7 +4242,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; + updateVonageProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; /** * Update a Vonage provider by its unique ID. * @@ -4247,7 +4256,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; + updateVonageProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; updateVonageProvider( paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] @@ -4317,7 +4326,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Provider>} */ - getProvider(params: { providerId: string }): Promise<Models.Provider>; + getProvider(this: Messaging<ServerAuth>, params: { providerId: string }): Promise<Models.Provider>; /** * Get a provider by its unique ID. * @@ -4327,7 +4336,7 @@ export class Messaging { * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - getProvider(providerId: string): Promise<Models.Provider>; + getProvider(this: Messaging<ServerAuth>, providerId: string): Promise<Models.Provider>; getProvider( paramsOrFirst: { providerId: string } | string ): Promise<Models.Provider> { @@ -4369,7 +4378,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteProvider(params: { providerId: string }): Promise<{}>; + deleteProvider(this: Messaging<ServerAuth>, params: { providerId: string }): Promise<{}>; /** * Delete a provider by its unique ID. * @@ -4378,7 +4387,7 @@ export class Messaging { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteProvider(providerId: string): Promise<{}>; + deleteProvider(this: Messaging<ServerAuth>, providerId: string): Promise<{}>; deleteProvider( paramsOrFirst: { providerId: string } | string ): Promise<{}> { @@ -4423,7 +4432,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.LogList>} */ - listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + listProviderLogs(this: Messaging<ServerAuth>, params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; /** * Get the provider activity logs listed by its unique ID. * @@ -4434,7 +4443,7 @@ export class Messaging { * @returns {Promise<Models.LogList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listProviderLogs(this: Messaging<ServerAuth>, providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; listProviderLogs( paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -4489,7 +4498,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.LogList>} */ - listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + listSubscriberLogs(this: Messaging<ServerAuth>, params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; /** * Get the subscriber activity logs listed by its unique ID. * @@ -4500,7 +4509,7 @@ export class Messaging { * @returns {Promise<Models.LogList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listSubscriberLogs(this: Messaging<ServerAuth>, subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; listSubscriberLogs( paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -4555,7 +4564,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.TopicList>} */ - listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; + listTopics(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; /** * Get a list of all topics from the current Appwrite project. * @@ -4566,7 +4575,7 @@ export class Messaging { * @returns {Promise<Models.TopicList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTopics(queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; + listTopics(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; listTopics( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -4621,7 +4630,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Topic>} */ - createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; + createTopic(this: Messaging<ServerAuth>, params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; /** * Create a new topic. * @@ -4632,7 +4641,7 @@ export class Messaging { * @returns {Promise<Models.Topic>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTopic(topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; + createTopic(this: Messaging<ServerAuth>, topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; createTopic( paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, ...rest: [(string)?, (string[])?] @@ -4693,7 +4702,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Topic>} */ - getTopic(params: { topicId: string }): Promise<Models.Topic>; + getTopic(this: Messaging<ServerAuth>, params: { topicId: string }): Promise<Models.Topic>; /** * Get a topic by its unique ID. * @@ -4703,7 +4712,7 @@ export class Messaging { * @returns {Promise<Models.Topic>} * @deprecated Use the object parameter style method for a better developer experience. */ - getTopic(topicId: string): Promise<Models.Topic>; + getTopic(this: Messaging<ServerAuth>, topicId: string): Promise<Models.Topic>; getTopic( paramsOrFirst: { topicId: string } | string ): Promise<Models.Topic> { @@ -4748,7 +4757,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Topic>} */ - updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; + updateTopic(this: Messaging<ServerAuth>, params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; /** * Update a topic by its unique ID. * @@ -4760,7 +4769,7 @@ export class Messaging { * @returns {Promise<Models.Topic>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; + updateTopic(this: Messaging<ServerAuth>, topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; updateTopic( paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, ...rest: [(string)?, (string[])?] @@ -4814,7 +4823,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTopic(params: { topicId: string }): Promise<{}>; + deleteTopic(this: Messaging<ServerAuth>, params: { topicId: string }): Promise<{}>; /** * Delete a topic by its unique ID. * @@ -4823,7 +4832,7 @@ export class Messaging { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteTopic(topicId: string): Promise<{}>; + deleteTopic(this: Messaging<ServerAuth>, topicId: string): Promise<{}>; deleteTopic( paramsOrFirst: { topicId: string } | string ): Promise<{}> { @@ -4868,7 +4877,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.LogList>} */ - listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + listTopicLogs(this: Messaging<ServerAuth>, params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; /** * Get the topic activity logs listed by its unique ID. * @@ -4879,7 +4888,7 @@ export class Messaging { * @returns {Promise<Models.LogList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listTopicLogs(this: Messaging<ServerAuth>, topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; listTopicLogs( paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] @@ -4935,7 +4944,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.SubscriberList>} */ - listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; + listSubscribers(this: Messaging<ServerAuth>, params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; /** * Get a list of all subscribers from the current Appwrite project. * @@ -4947,7 +4956,7 @@ export class Messaging { * @returns {Promise<Models.SubscriberList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; + listSubscribers(this: Messaging<ServerAuth>, topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; listSubscribers( paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, ...rest: [(string[])?, (string)?, (boolean)?] @@ -5080,7 +5089,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<Models.Subscriber>} */ - getSubscriber(params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; + getSubscriber(this: Messaging<ServerAuth>, params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; /** * Get a subscriber by its unique ID. * @@ -5091,7 +5100,7 @@ export class Messaging { * @returns {Promise<Models.Subscriber>} * @deprecated Use the object parameter style method for a better developer experience. */ - getSubscriber(topicId: string, subscriberId: string): Promise<Models.Subscriber>; + getSubscriber(this: Messaging<ServerAuth>, topicId: string, subscriberId: string): Promise<Models.Subscriber>; getSubscriber( paramsOrFirst: { topicId: string, subscriberId: string } | string, ...rest: [(string)?] @@ -5192,3 +5201,9 @@ export class Messaging { ); } } + +const Messaging = MessagingRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Messaging<TAuth>; +}; + +export { Messaging }; diff --git a/src/services/project.ts b/src/services/project.ts index 08f00012..f2d865c3 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -1,5 +1,4 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { AuthMethod } from '../enums/auth-method'; @@ -13,10 +12,12 @@ import { Secure } from '../enums/secure'; import { EmailTemplateType } from '../enums/email-template-type'; import { EmailTemplateLocale } from '../enums/email-template-locale'; -export class Project { - client: Client; +export type Project = Omit<ProjectRuntime, 'client'>; - constructor(client: Client) { +class ProjectRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -6434,3 +6435,9 @@ export class Project { ); } } + +const Project = ProjectRuntime as unknown as { + new (client: Client<ServerAuth>): Project; +}; + +export { Project }; diff --git a/src/services/proxy.ts b/src/services/proxy.ts index a5a86736..6e8e0919 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -1,14 +1,15 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { StatusCode } from '../enums/status-code'; import { ProxyResourceType } from '../enums/proxy-resource-type'; -export class Proxy { - client: Client; +export type Proxy = Omit<ProxyRuntime, 'client'>; - constructor(client: Client) { +class ProxyRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -539,3 +540,9 @@ export class Proxy { ); } } + +const Proxy = ProxyRuntime as unknown as { + new (client: Client<ServerAuth>): Proxy; +}; + +export { Proxy }; diff --git a/src/services/realtime.ts b/src/services/realtime.ts index a1368b9e..71436bf4 100644 --- a/src/services/realtime.ts +++ b/src/services/realtime.ts @@ -1,4 +1,4 @@ -import { AppwriteException, Client, JSONbig } from '../client'; +import { AppwriteException, Client, JSONbig, type ClientAuth } from '../client'; import { Channel, ActionableChannel, ResolvedChannel } from '../channel'; import { Query } from '../query'; import { ID } from '../id'; @@ -77,7 +77,7 @@ export class Realtime { private readonly DEBOUNCE_MS = 1; private readonly HEARTBEAT_INTERVAL = 20000; // 20 seconds in milliseconds - private client: Client; + private client: Client<ClientAuth>; private socket?: WebSocket; private activeSubscriptions = new Map<string, RealtimeCallback<any>>(); private pendingSubscribes = new Map<string, RealtimeRequestSubscribeRow>(); @@ -92,7 +92,7 @@ export class Realtime { private onCloseCallbacks: Array<() => void> = []; private onOpenCallbacks: Array<() => void> = []; - constructor(client: Client) { + constructor(client: Client<ClientAuth>) { this.client = client; } @@ -128,16 +128,26 @@ export class Realtime { private startHeartbeat(): void { this.stopHeartbeat(); - this.heartbeatTimer = window?.setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL); + this.heartbeatTimer = typeof window !== 'undefined' + ? window.setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL) + : setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL) as unknown as number; } private stopHeartbeat(): void { if (this.heartbeatTimer) { - window?.clearInterval(this.heartbeatTimer); + if (typeof window !== 'undefined') { + window.clearInterval(this.heartbeatTimer); + } else { + clearInterval(this.heartbeatTimer as any); + } this.heartbeatTimer = undefined; } } @@ -566,8 +576,10 @@ export class Realtime { let session = this.client.config.session; if (!session) { try { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.client.config.project}`]; + if (typeof window !== 'undefined' && window.localStorage) { + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.client.config.project}`]; + } } catch (error) { console.error('Failed to parse cookie fallback:', error); } diff --git a/src/services/sites.ts b/src/services/sites.ts index fbad3468..5e3827af 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1,5 +1,5 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { Framework } from '../enums/framework'; @@ -9,10 +9,12 @@ import { TemplateReferenceType } from '../enums/template-reference-type'; import { VCSReferenceType } from '../enums/vcs-reference-type'; import { DeploymentDownloadType } from '../enums/deployment-download-type'; -export class Sites { - client: Client; +export type Sites = Omit<SitesRuntime, 'client'>; - constructor(client: Client) { +class SitesRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -1304,8 +1306,8 @@ export class Sites { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['key'] = this.client.config.key; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1915,3 +1917,9 @@ export class Sites { ); } } + +const Sites = SitesRuntime as unknown as { + new (client: Client<ServerAuth>): Sites; +}; + +export { Sites }; diff --git a/src/services/storage.ts b/src/services/storage.ts index 00f50cea..4a3f12d4 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,15 +1,25 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; -export class Storage { - client: Client; +type StorageServerOnlyMethod = 'listBuckets' | 'createBucket' | 'getBucket' | 'updateBucket' | 'deleteBucket'; +type StorageClientOnlyMethod = never; - constructor(client: Client) { +export type Storage<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<StorageRuntime<TAuth>, 'client' | StorageServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<StorageRuntime<TAuth>, 'client' | StorageClientOnlyMethod> + : Omit<StorageRuntime<TAuth>, 'client'>; + +class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -22,7 +32,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<Models.BucketList>} */ - listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; + listBuckets(this: Storage<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; /** * Get a list of all the storage buckets. You can use the query params to filter your results. * @@ -33,7 +43,7 @@ export class Storage { * @returns {Promise<Models.BucketList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; + listBuckets(this: Storage<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; listBuckets( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -96,7 +106,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<Models.Bucket>} */ - createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + createBucket(this: Storage<ServerAuth>, params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; /** * Create a new storage bucket. * @@ -115,7 +125,7 @@ export class Storage { * @returns {Promise<Models.Bucket>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + createBucket(this: Storage<ServerAuth>, bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; createBucket( paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] @@ -215,7 +225,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<Models.Bucket>} */ - getBucket(params: { bucketId: string }): Promise<Models.Bucket>; + getBucket(this: Storage<ServerAuth>, params: { bucketId: string }): Promise<Models.Bucket>; /** * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. * @@ -224,7 +234,7 @@ export class Storage { * @returns {Promise<Models.Bucket>} * @deprecated Use the object parameter style method for a better developer experience. */ - getBucket(bucketId: string): Promise<Models.Bucket>; + getBucket(this: Storage<ServerAuth>, bucketId: string): Promise<Models.Bucket>; getBucket( paramsOrFirst: { bucketId: string } | string ): Promise<Models.Bucket> { @@ -276,7 +286,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<Models.Bucket>} */ - updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + updateBucket(this: Storage<ServerAuth>, params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; /** * Update a storage bucket by its unique ID. * @@ -295,7 +305,7 @@ export class Storage { * @returns {Promise<Models.Bucket>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + updateBucket(this: Storage<ServerAuth>, bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; updateBucket( paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] @@ -392,7 +402,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteBucket(params: { bucketId: string }): Promise<{}>; + deleteBucket(this: Storage<ServerAuth>, params: { bucketId: string }): Promise<{}>; /** * Delete a storage bucket by its unique ID. * @@ -401,7 +411,7 @@ export class Storage { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteBucket(bucketId: string): Promise<{}>; + deleteBucket(this: Storage<ServerAuth>, bucketId: string): Promise<{}>; deleteBucket( paramsOrFirst: { bucketId: string } | string ): Promise<{}> { @@ -859,8 +869,8 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1004,8 +1014,8 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1072,8 +1082,8 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; - payload['session'] = this.client.config.session; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1082,3 +1092,9 @@ export class Storage { return uri.toString(); } } + +const Storage = StorageRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Storage<TAuth>; +}; + +export { Storage }; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 49d83748..3e351951 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1,5 +1,4 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { RelationshipType } from '../enums/relationship-type'; @@ -7,10 +6,20 @@ import { RelationMutate } from '../enums/relation-mutate'; import { TablesDBIndexType } from '../enums/tables-db-index-type'; import { OrderBy } from '../enums/order-by'; -export class TablesDB { - client: Client; +type TablesDBServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listTables' | 'createTable' | 'getTable' | 'updateTable' | 'deleteTable' | 'listColumns' | 'createBigIntColumn' | 'updateBigIntColumn' | 'createBooleanColumn' | 'updateBooleanColumn' | 'createDatetimeColumn' | 'updateDatetimeColumn' | 'createEmailColumn' | 'updateEmailColumn' | 'createEnumColumn' | 'updateEnumColumn' | 'createFloatColumn' | 'updateFloatColumn' | 'createIntegerColumn' | 'updateIntegerColumn' | 'createIpColumn' | 'updateIpColumn' | 'createLineColumn' | 'updateLineColumn' | 'createLongtextColumn' | 'updateLongtextColumn' | 'createMediumtextColumn' | 'updateMediumtextColumn' | 'createPointColumn' | 'updatePointColumn' | 'createPolygonColumn' | 'updatePolygonColumn' | 'createRelationshipColumn' | 'createStringColumn' | 'updateStringColumn' | 'createTextColumn' | 'updateTextColumn' | 'createUrlColumn' | 'updateUrlColumn' | 'createVarcharColumn' | 'updateVarcharColumn' | 'getColumn' | 'deleteColumn' | 'updateRelationshipColumn' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex' | 'upsertRows' | 'updateRows' | 'deleteRows'; +type TablesDBClientOnlyMethod = never; - constructor(client: Client) { +export type TablesDB<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBClientOnlyMethod> + : Omit<TablesDBRuntime<TAuth>, 'client'>; + +class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -23,7 +32,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.DatabaseList>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + list(this: TablesDB<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -34,7 +43,7 @@ export class TablesDB { * @returns {Promise<Models.DatabaseList>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list(this: TablesDB<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; list( paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], ...rest: [(string)?, (boolean)?] @@ -90,7 +99,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Database>} */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + create(this: TablesDB<ServerAuth>, params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; /** * Create a new Database. * @@ -102,7 +111,7 @@ export class TablesDB { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create(this: TablesDB<ServerAuth>, databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; create( paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] @@ -495,7 +504,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Database>} */ - get(params: { databaseId: string }): Promise<Models.Database>; + get(this: TablesDB<ServerAuth>, params: { databaseId: string }): Promise<Models.Database>; /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -504,7 +513,7 @@ export class TablesDB { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - get(databaseId: string): Promise<Models.Database>; + get(this: TablesDB<ServerAuth>, databaseId: string): Promise<Models.Database>; get( paramsOrFirst: { databaseId: string } | string ): Promise<Models.Database> { @@ -548,7 +557,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Database>} */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; + update(this: TablesDB<ServerAuth>, params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; /** * Update a database by its unique ID. * @@ -559,7 +568,7 @@ export class TablesDB { * @returns {Promise<Models.Database>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update(this: TablesDB<ServerAuth>, databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; update( paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, ...rest: [(string)?, (boolean)?] @@ -613,7 +622,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - delete(params: { databaseId: string }): Promise<{}>; + delete(this: TablesDB<ServerAuth>, params: { databaseId: string }): Promise<{}>; /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -622,7 +631,7 @@ export class TablesDB { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - delete(databaseId: string): Promise<{}>; + delete(this: TablesDB<ServerAuth>, databaseId: string): Promise<{}>; delete( paramsOrFirst: { databaseId: string } | string ): Promise<{}> { @@ -668,7 +677,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.TableList>} */ - listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; + listTables(this: TablesDB<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; /** * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -680,7 +689,7 @@ export class TablesDB { * @returns {Promise<Models.TableList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; + listTables(this: TablesDB<ServerAuth>, databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; listTables( paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, ...rest: [(string[])?, (string)?, (boolean)?] @@ -745,7 +754,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Table>} */ - createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; + createTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; /** * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -761,7 +770,7 @@ export class TablesDB { * @returns {Promise<Models.Table>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTable(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; + createTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; createTable( paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] @@ -847,7 +856,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Table>} */ - getTable(params: { databaseId: string, tableId: string }): Promise<Models.Table>; + getTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string }): Promise<Models.Table>; /** * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. * @@ -857,7 +866,7 @@ export class TablesDB { * @returns {Promise<Models.Table>} * @deprecated Use the object parameter style method for a better developer experience. */ - getTable(databaseId: string, tableId: string): Promise<Models.Table>; + getTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string): Promise<Models.Table>; getTable( paramsOrFirst: { databaseId: string, tableId: string } | string, ...rest: [(string)?] @@ -911,7 +920,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.Table>} */ - updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; + updateTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; /** * Update a table by its unique ID. * @@ -926,7 +935,7 @@ export class TablesDB { * @returns {Promise<Models.Table>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; + updateTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; updateTable( paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] @@ -1001,7 +1010,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; + deleteTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string }): Promise<{}>; /** * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. * @@ -1011,7 +1020,7 @@ export class TablesDB { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteTable(databaseId: string, tableId: string): Promise<{}>; + deleteTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string): Promise<{}>; deleteTable( paramsOrFirst: { databaseId: string, tableId: string } | string, ...rest: [(string)?] @@ -1063,7 +1072,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnList>} */ - listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; + listColumns(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; /** * List columns in the table. * @@ -1075,7 +1084,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; + listColumns(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; listColumns( paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?] @@ -1141,7 +1150,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnBigint>} */ - createBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; + createBigIntColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; /** * Create a bigint column. Optionally, minimum and maximum values can be provided. * @@ -1158,7 +1167,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnBigint>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; + createBigIntColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; createBigIntColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] @@ -1251,7 +1260,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnBigint>} */ - updateBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; + updateBigIntColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; /** * Update a bigint column. Changing the `default` value will not update already existing rows. * @@ -1268,7 +1277,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnBigint>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; + updateBigIntColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; updateBigIntColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] @@ -1359,7 +1368,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnBoolean>} */ - createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; + createBooleanColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; /** * Create a boolean column. * @@ -1374,7 +1383,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnBoolean>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; + createBooleanColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; createBooleanColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] @@ -1454,7 +1463,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnBoolean>} */ - updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; + updateBooleanColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; /** * Update a boolean column. Changing the `default` value will not update already existing rows. * @@ -1468,7 +1477,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnBoolean>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; + updateBooleanColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; updateBooleanColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] @@ -1548,7 +1557,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnDatetime>} */ - createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; + createDatetimeColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; /** * Create a date time column according to the ISO 8601 standard. * @@ -1562,7 +1571,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnDatetime>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; + createDatetimeColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; createDatetimeColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -1642,7 +1651,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnDatetime>} */ - updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; + updateDatetimeColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; /** * Update a date time column. Changing the `default` value will not update already existing rows. * @@ -1656,7 +1665,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnDatetime>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; + updateDatetimeColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; updateDatetimeColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -1737,7 +1746,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnEmail>} */ - createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; + createEmailColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; /** * Create an email column. * @@ -1752,7 +1761,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnEmail>} * @deprecated Use the object parameter style method for a better developer experience. */ - createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; + createEmailColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; createEmailColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -1833,7 +1842,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnEmail>} */ - updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; + updateEmailColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; /** * Update an email column. Changing the `default` value will not update already existing rows. * @@ -1848,7 +1857,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnEmail>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; + updateEmailColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; updateEmailColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -1929,7 +1938,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnEnum>} */ - createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; + createEnumColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; /** * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. * @@ -1944,7 +1953,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnEnum>} * @deprecated Use the object parameter style method for a better developer experience. */ - createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; + createEnumColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; createEnumColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] @@ -2034,7 +2043,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnEnum>} */ - updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; + updateEnumColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; /** * Update an enum column. Changing the `default` value will not update already existing rows. * @@ -2050,7 +2059,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnEnum>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; + updateEnumColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; updateEnumColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] @@ -2141,7 +2150,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnFloat>} */ - createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; + createFloatColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; /** * Create a float column. Optionally, minimum and maximum values can be provided. * @@ -2158,7 +2167,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnFloat>} * @deprecated Use the object parameter style method for a better developer experience. */ - createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; + createFloatColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; createFloatColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] @@ -2251,7 +2260,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnFloat>} */ - updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; + updateFloatColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; /** * Update a float column. Changing the `default` value will not update already existing rows. * @@ -2268,7 +2277,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnFloat>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; + updateFloatColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; updateFloatColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] @@ -2361,7 +2370,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnInteger>} */ - createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; + createIntegerColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; /** * Create an integer column. Optionally, minimum and maximum values can be provided. * @@ -2378,7 +2387,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnInteger>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; + createIntegerColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; createIntegerColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] @@ -2471,7 +2480,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnInteger>} */ - updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; + updateIntegerColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; /** * Update an integer column. Changing the `default` value will not update already existing rows. * @@ -2488,7 +2497,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnInteger>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; + updateIntegerColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; updateIntegerColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] @@ -2579,7 +2588,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnIp>} */ - createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; + createIpColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; /** * Create IP address column. * @@ -2594,7 +2603,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnIp>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; + createIpColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; createIpColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -2675,7 +2684,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnIp>} */ - updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; + updateIpColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; /** * Update an ip column. Changing the `default` value will not update already existing rows. * @@ -2690,7 +2699,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnIp>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; + updateIpColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; updateIpColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -2769,7 +2778,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnLine>} */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; + createLineColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; /** * Create a geometric line column. * @@ -2782,7 +2791,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnLine>} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; + createLineColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; createLineColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -2857,7 +2866,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnLine>} */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; + updateLineColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; /** * Update a line column. Changing the `default` value will not update already existing rows. * @@ -2871,7 +2880,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnLine>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; + updateLineColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; updateLineColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -2950,7 +2959,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnLongtext>} */ - createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; + createLongtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; /** * Create a longtext column. * @@ -2966,7 +2975,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnLongtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; + createLongtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; createLongtextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -3052,7 +3061,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnLongtext>} */ - updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; + updateLongtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; /** * Update a longtext column. Changing the `default` value will not update already existing rows. * @@ -3067,7 +3076,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnLongtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; + updateLongtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; updateLongtextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -3149,7 +3158,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnMediumtext>} */ - createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; + createMediumtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; /** * Create a mediumtext column. * @@ -3165,7 +3174,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnMediumtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; + createMediumtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; createMediumtextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -3251,7 +3260,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnMediumtext>} */ - updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; + updateMediumtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; /** * Update a mediumtext column. Changing the `default` value will not update already existing rows. * @@ -3266,7 +3275,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnMediumtext>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; + updateMediumtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; updateMediumtextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -3345,7 +3354,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnPoint>} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; + createPointColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; /** * Create a geometric point column. * @@ -3358,7 +3367,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnPoint>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; + createPointColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; createPointColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -3433,7 +3442,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnPoint>} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; + updatePointColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; /** * Update a point column. Changing the `default` value will not update already existing rows. * @@ -3447,7 +3456,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnPoint>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; + updatePointColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; updatePointColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -3523,7 +3532,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnPolygon>} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; + createPolygonColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; /** * Create a geometric polygon column. * @@ -3536,7 +3545,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnPolygon>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; + createPolygonColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; createPolygonColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?] @@ -3611,7 +3620,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnPolygon>} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; + updatePolygonColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; /** * Update a polygon column. Changing the `default` value will not update already existing rows. * @@ -3625,7 +3634,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnPolygon>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; + updatePolygonColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; updatePolygonColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] @@ -3705,7 +3714,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnRelationship>} */ - createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; + createRelationshipColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; /** * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * @@ -3722,7 +3731,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnRelationship>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; + createRelationshipColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; createRelationshipColumn( paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] @@ -3816,7 +3825,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnString>} * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. */ - createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; + createStringColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; /** * Create a string column. * @@ -3833,7 +3842,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnString>} * @deprecated Use the object parameter style method for a better developer experience. */ - createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; + createStringColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; createStringColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -3929,7 +3938,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnString>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. */ - updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; + updateStringColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; /** * Update a string column. Changing the `default` value will not update already existing rows. * @@ -3945,7 +3954,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnString>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; + updateStringColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; updateStringColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] @@ -4032,7 +4041,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnText>} */ - createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; + createTextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; /** * Create a text column. * @@ -4048,7 +4057,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnText>} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; + createTextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; createTextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -4134,7 +4143,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnText>} */ - updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; + updateTextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; /** * Update a text column. Changing the `default` value will not update already existing rows. * @@ -4149,7 +4158,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnText>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; + updateTextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; updateTextColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -4230,7 +4239,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnUrl>} */ - createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; + createUrlColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; /** * Create a URL column. * @@ -4245,7 +4254,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnUrl>} * @deprecated Use the object parameter style method for a better developer experience. */ - createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; + createUrlColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; createUrlColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] @@ -4326,7 +4335,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnUrl>} */ - updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; + updateUrlColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; /** * Update an url column. Changing the `default` value will not update already existing rows. * @@ -4341,7 +4350,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnUrl>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; + updateUrlColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; updateUrlColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] @@ -4424,7 +4433,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnVarchar>} */ - createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; + createVarcharColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; /** * Create a varchar column. * @@ -4441,7 +4450,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnVarchar>} * @deprecated Use the object parameter style method for a better developer experience. */ - createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; + createVarcharColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; createVarcharColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] @@ -4536,7 +4545,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnVarchar>} */ - updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; + updateVarcharColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; /** * Update a varchar column. Changing the `default` value will not update already existing rows. * @@ -4552,7 +4561,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnVarchar>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVarcharColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; + updateVarcharColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; updateVarcharColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] @@ -4634,7 +4643,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} */ - getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + getColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; /** * Get column by ID. * @@ -4645,7 +4654,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} * @deprecated Use the object parameter style method for a better developer experience. */ - getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + getColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; getColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -4700,7 +4709,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<{}>; /** * Deletes a column. * @@ -4711,7 +4720,7 @@ export class TablesDB { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<{}>; deleteColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -4770,7 +4779,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnRelationship>} */ - updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; + updateRelationshipColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; /** * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). * @@ -4784,7 +4793,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnRelationship>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; + updateRelationshipColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; updateRelationshipColumn( paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] @@ -4851,7 +4860,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnIndexList>} */ - listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; + listIndexes(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; /** * List indexes on the table. * @@ -4863,7 +4872,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnIndexList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; + listIndexes(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; listIndexes( paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, ...rest: [(string)?, (string[])?, (boolean)?] @@ -4928,7 +4937,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnIndex>} */ - createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; + createIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; /** * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. * Type can be `key`, `fulltext`, or `unique`. @@ -4944,7 +4953,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnIndex>} * @deprecated Use the object parameter style method for a better developer experience. */ - createIndex(databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; + createIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; createIndex( paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] @@ -5029,7 +5038,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.ColumnIndex>} */ - getIndex(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; + getIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; /** * Get index by ID. * @@ -5040,7 +5049,7 @@ export class TablesDB { * @returns {Promise<Models.ColumnIndex>} * @deprecated Use the object parameter style method for a better developer experience. */ - getIndex(databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; + getIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; getIndex( paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -5095,7 +5104,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<{}>; /** * Delete an index. * @@ -5106,7 +5115,7 @@ export class TablesDB { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<{}>; deleteIndex( paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, ...rest: [(string)?, (string)?] @@ -5422,7 +5431,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.RowList<Row>>} */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; /** * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * @@ -5435,7 +5444,7 @@ export class TablesDB { * @returns {Promise<Models.RowList<Row>>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; + upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; upsertRows<Row extends Models.Row = Models.DefaultRow>( paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, ...rest: [(string)?, (object[])?, (string)?] @@ -5501,7 +5510,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.RowList<Row>>} */ - updateRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; /** * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. * @@ -5514,7 +5523,7 @@ export class TablesDB { * @returns {Promise<Models.RowList<Row>>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; updateRows<Row extends Models.Row = Models.DefaultRow>( paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, ...rest: [(string)?, (object)?, (string[])?, (string)?] @@ -5581,7 +5590,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<Models.RowList<Row>>} */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; /** * Bulk delete rows using queries, if no queries are passed then all rows are deleted. * @@ -5593,7 +5602,7 @@ export class TablesDB { * @returns {Promise<Models.RowList<Row>>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; deleteRows<Row extends Models.Row = Models.DefaultRow>( paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, ...rest: [(string)?, (string[])?, (string)?] @@ -6165,3 +6174,9 @@ export class TablesDB { ); } } + +const TablesDB = TablesDBRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): TablesDB<TAuth>; +}; + +export { TablesDB }; diff --git a/src/services/teams.ts b/src/services/teams.ts index 870f8a5b..cdcf75ca 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Teams { - client: Client; +type TeamsServerOnlyMethod = never; +type TeamsClientOnlyMethod = never; - constructor(client: Client) { +export type Teams<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsClientOnlyMethod> + : Omit<TeamsRuntime<TAuth>, 'client'>; + +class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -891,3 +900,9 @@ export class Teams { ); } } + +const Teams = TeamsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Teams<TAuth>; +}; + +export { Teams }; diff --git a/src/services/tokens.ts b/src/services/tokens.ts index daffdae2..eb904d5c 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -1,12 +1,13 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Tokens { - client: Client; +export type Tokens = Omit<TokensRuntime, 'client'>; - constructor(client: Client) { +class TokensRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -313,3 +314,9 @@ export class Tokens { ); } } + +const Tokens = TokensRuntime as unknown as { + new (client: Client<ServerAuth>): Tokens; +}; + +export { Tokens }; diff --git a/src/services/users.ts b/src/services/users.ts index 54df17b8..46e89596 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -1,15 +1,16 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { PasswordHash } from '../enums/password-hash'; import { AuthenticatorType } from '../enums/authenticator-type'; import { MessagingProviderType } from '../enums/messaging-provider-type'; -export class Users { - client: Client; +export type Users = Omit<UsersRuntime, 'client'>; - constructor(client: Client) { +class UsersRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -3268,3 +3269,9 @@ export class Users { ); } } + +const Users = UsersRuntime as unknown as { + new (client: Client<ServerAuth>): Users; +}; + +export { Users }; diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index ee3cd84f..4347018b 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -1,12 +1,13 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Webhooks { - client: Client; +export type Webhooks = Omit<WebhooksRuntime, 'client'>; - constructor(client: Client) { +class WebhooksRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { this.client = client; } @@ -464,3 +465,9 @@ export class Webhooks { ); } } + +const Webhooks = WebhooksRuntime as unknown as { + new (client: Client<ServerAuth>): Webhooks; +}; + +export { Webhooks }; From 4c6a618d58a0128116464da4c01449ff404ab65d Mon Sep 17 00:00:00 2001 From: root <arnabchatterjee.ac.2@gmail.com> Date: Mon, 18 May 2026 12:33:31 +0000 Subject: [PATCH 4/5] chore: update Web SDK to 25.1.0 --- CHANGELOG.md | 18 +- README.md | 4 +- .../account/create-o-auth-2-session.md | 17 + docs/examples/account/create-push-target.md | 17 + docs/examples/account/delete-push-target.md | 15 + docs/examples/account/update-push-target.md | 16 + docs/examples/activities/get-event.md | 16 - docs/examples/activities/list-events.md | 16 - docs/examples/advisor/get-insight.md | 16 + docs/examples/advisor/get-report.md | 15 + docs/examples/advisor/list-insights.md | 17 + docs/examples/advisor/list-reports.md | 16 + docs/examples/backups/create-archive.md | 17 - docs/examples/backups/create-policy.md | 22 - docs/examples/backups/create-restoration.md | 19 - docs/examples/backups/delete-archive.md | 16 - docs/examples/backups/delete-policy.md | 16 - docs/examples/backups/get-archive.md | 16 - docs/examples/backups/get-policy.md | 16 - docs/examples/backups/get-restoration.md | 16 - docs/examples/backups/list-archives.md | 16 - docs/examples/backups/list-policies.md | 16 - docs/examples/backups/list-restorations.md | 16 - docs/examples/backups/update-policy.md | 20 - .../databases/create-big-int-attribute.md | 23 - .../databases/create-boolean-attribute.md | 21 - docs/examples/databases/create-collection.md | 23 - .../databases/create-datetime-attribute.md | 21 - docs/examples/databases/create-documents.md | 19 - .../databases/create-email-attribute.md | 21 - .../databases/create-enum-attribute.md | 22 - .../databases/create-float-attribute.md | 23 - docs/examples/databases/create-index.md | 22 - .../databases/create-integer-attribute.md | 23 - .../examples/databases/create-ip-attribute.md | 21 - .../databases/create-line-attribute.md | 20 - .../databases/create-longtext-attribute.md | 22 - .../databases/create-mediumtext-attribute.md | 22 - docs/examples/databases/create-operations.md | 3 +- .../databases/create-point-attribute.md | 20 - .../databases/create-polygon-attribute.md | 20 - .../create-relationship-attribute.md | 23 - .../databases/create-string-attribute.md | 23 - .../databases/create-text-attribute.md | 22 - docs/examples/databases/create-transaction.md | 3 +- .../databases/create-url-attribute.md | 21 - .../databases/create-varchar-attribute.md | 23 - docs/examples/databases/create.md | 18 - docs/examples/databases/delete-attribute.md | 18 - docs/examples/databases/delete-collection.md | 17 - docs/examples/databases/delete-documents.md | 19 - docs/examples/databases/delete-index.md | 18 - docs/examples/databases/delete-transaction.md | 3 +- docs/examples/databases/delete.md | 16 - docs/examples/databases/get-attribute.md | 18 - docs/examples/databases/get-collection.md | 17 - docs/examples/databases/get-index.md | 18 - docs/examples/databases/get-transaction.md | 3 +- docs/examples/databases/get.md | 16 - docs/examples/databases/list-attributes.md | 19 - docs/examples/databases/list-collections.md | 19 - docs/examples/databases/list-indexes.md | 19 - docs/examples/databases/list-transactions.md | 3 +- docs/examples/databases/list.md | 18 - .../databases/update-big-int-attribute.md | 23 - .../databases/update-boolean-attribute.md | 21 - docs/examples/databases/update-collection.md | 22 - .../databases/update-datetime-attribute.md | 21 - docs/examples/databases/update-documents.md | 26 - .../databases/update-email-attribute.md | 21 - .../databases/update-enum-attribute.md | 22 - .../databases/update-float-attribute.md | 23 - .../databases/update-integer-attribute.md | 23 - .../examples/databases/update-ip-attribute.md | 21 - .../databases/update-line-attribute.md | 21 - .../databases/update-longtext-attribute.md | 21 - .../databases/update-mediumtext-attribute.md | 21 - .../databases/update-point-attribute.md | 21 - .../databases/update-polygon-attribute.md | 21 - .../update-relationship-attribute.md | 20 - .../databases/update-string-attribute.md | 22 - .../databases/update-text-attribute.md | 21 - docs/examples/databases/update-transaction.md | 3 +- .../databases/update-url-attribute.md | 21 - .../databases/update-varchar-attribute.md | 22 - docs/examples/databases/update.md | 18 - docs/examples/databases/upsert-documents.md | 19 - docs/examples/functions/create-deployment.md | 20 - .../functions/create-duplicate-deployment.md | 18 - .../functions/create-template-deployment.md | 22 - docs/examples/functions/create-variable.md | 20 - .../functions/create-vcs-deployment.md | 19 - docs/examples/functions/create.md | 35 - docs/examples/functions/delete-deployment.md | 17 - docs/examples/functions/delete-execution.md | 17 - docs/examples/functions/delete-variable.md | 17 - docs/examples/functions/delete.md | 16 - .../functions/get-deployment-download.md | 18 - docs/examples/functions/get-deployment.md | 17 - docs/examples/functions/get-variable.md | 17 - docs/examples/functions/get.md | 16 - docs/examples/functions/list-deployments.md | 19 - docs/examples/functions/list-runtimes.md | 14 - .../examples/functions/list-specifications.md | 14 - docs/examples/functions/list-variables.md | 18 - docs/examples/functions/list.md | 18 - .../functions/update-deployment-status.md | 17 - .../functions/update-function-deployment.md | 17 - docs/examples/functions/update-variable.md | 20 - docs/examples/functions/update.md | 35 - docs/examples/graphql/mutation.md | 3 +- docs/examples/graphql/query.md | 3 +- docs/examples/health/get-antivirus.md | 14 - docs/examples/health/get-cache.md | 14 - docs/examples/health/get-certificate.md | 16 - docs/examples/health/get-console-pausing.md | 17 - docs/examples/health/get-db.md | 14 - docs/examples/health/get-failed-jobs.md | 17 - docs/examples/health/get-pub-sub.md | 14 - docs/examples/health/get-queue-audits.md | 16 - docs/examples/health/get-queue-builds.md | 16 - .../examples/health/get-queue-certificates.md | 16 - docs/examples/health/get-queue-databases.md | 17 - docs/examples/health/get-queue-deletes.md | 16 - docs/examples/health/get-queue-functions.md | 16 - docs/examples/health/get-queue-logs.md | 16 - docs/examples/health/get-queue-mails.md | 16 - docs/examples/health/get-queue-messaging.md | 16 - docs/examples/health/get-queue-migrations.md | 16 - .../health/get-queue-stats-resources.md | 16 - docs/examples/health/get-queue-usage.md | 16 - docs/examples/health/get-queue-webhooks.md | 16 - docs/examples/health/get-storage-local.md | 14 - docs/examples/health/get-storage.md | 14 - docs/examples/health/get-time.md | 14 - docs/examples/health/get.md | 14 - .../messaging/create-apns-provider.md | 23 - docs/examples/messaging/create-email.md | 27 - .../examples/messaging/create-fcm-provider.md | 19 - .../messaging/create-mailgun-provider.md | 25 - .../messaging/create-msg-91-provider.md | 21 - docs/examples/messaging/create-push.md | 34 - .../messaging/create-resend-provider.md | 23 - .../messaging/create-sendgrid-provider.md | 23 - docs/examples/messaging/create-sms.md | 22 - .../messaging/create-smtp-provider.md | 29 - docs/examples/messaging/create-subscriber.md | 3 +- .../messaging/create-telesign-provider.md | 21 - .../messaging/create-textmagic-provider.md | 21 - docs/examples/messaging/create-topic.md | 18 - .../messaging/create-twilio-provider.md | 21 - .../messaging/create-vonage-provider.md | 21 - docs/examples/messaging/delete-provider.md | 16 - docs/examples/messaging/delete-subscriber.md | 3 +- docs/examples/messaging/delete-topic.md | 16 - docs/examples/messaging/delete.md | 16 - docs/examples/messaging/get-message.md | 16 - docs/examples/messaging/get-provider.md | 16 - docs/examples/messaging/get-subscriber.md | 17 - docs/examples/messaging/get-topic.md | 16 - docs/examples/messaging/list-message-logs.md | 18 - docs/examples/messaging/list-messages.md | 18 - docs/examples/messaging/list-provider-logs.md | 18 - docs/examples/messaging/list-providers.md | 18 - .../messaging/list-subscriber-logs.md | 18 - docs/examples/messaging/list-subscribers.md | 19 - docs/examples/messaging/list-targets.md | 18 - docs/examples/messaging/list-topic-logs.md | 18 - docs/examples/messaging/list-topics.md | 18 - .../messaging/update-apns-provider.md | 23 - docs/examples/messaging/update-email.md | 27 - .../examples/messaging/update-fcm-provider.md | 19 - .../messaging/update-mailgun-provider.md | 25 - .../messaging/update-msg-91-provider.md | 21 - docs/examples/messaging/update-push.md | 34 - .../messaging/update-resend-provider.md | 23 - .../messaging/update-sendgrid-provider.md | 23 - docs/examples/messaging/update-sms.md | 22 - .../messaging/update-smtp-provider.md | 29 - .../messaging/update-telesign-provider.md | 21 - .../messaging/update-textmagic-provider.md | 21 - docs/examples/messaging/update-topic.md | 18 - .../messaging/update-twilio-provider.md | 21 - .../messaging/update-vonage-provider.md | 21 - docs/examples/presences/delete.md | 15 + docs/examples/presences/get.md | 15 + docs/examples/presences/list.md | 17 + docs/examples/presences/update.md | 20 + docs/examples/presences/upsert.md | 19 + .../project/create-android-platform.md | 18 - .../examples/project/create-apple-platform.md | 18 - docs/examples/project/create-ephemeral-key.md | 17 - docs/examples/project/create-key.md | 19 - .../examples/project/create-linux-platform.md | 18 - docs/examples/project/create-mock-phone.md | 17 - docs/examples/project/create-smtp-test.md | 16 - docs/examples/project/create-variable.md | 19 - docs/examples/project/create-web-platform.md | 18 - .../project/create-windows-platform.md | 18 - docs/examples/project/delete-key.md | 16 - docs/examples/project/delete-mock-phone.md | 16 - docs/examples/project/delete-platform.md | 16 - docs/examples/project/delete-variable.md | 16 - docs/examples/project/delete.md | 14 - docs/examples/project/get-email-template.md | 17 - docs/examples/project/get-key.md | 16 - docs/examples/project/get-mock-phone.md | 16 - .../examples/project/get-o-auth-2-provider.md | 16 - docs/examples/project/get-platform.md | 16 - docs/examples/project/get-policy.md | 16 - docs/examples/project/get-variable.md | 16 - docs/examples/project/list-email-templates.md | 17 - docs/examples/project/list-keys.md | 17 - docs/examples/project/list-mock-phones.md | 17 - .../project/list-o-auth-2-providers.md | 17 - docs/examples/project/list-platforms.md | 17 - docs/examples/project/list-policies.md | 17 - docs/examples/project/list-variables.md | 17 - .../project/update-android-platform.md | 18 - .../examples/project/update-apple-platform.md | 18 - docs/examples/project/update-auth-method.md | 17 - .../update-deny-canonical-email-policy.md | 16 - .../update-deny-disposable-email-policy.md | 16 - .../project/update-deny-free-email-policy.md | 16 - .../examples/project/update-email-template.md | 23 - docs/examples/project/update-key.md | 19 - docs/examples/project/update-labels.md | 16 - .../examples/project/update-linux-platform.md | 18 - .../update-membership-privacy-policy.md | 20 - docs/examples/project/update-mock-phone.md | 17 - .../project/update-o-auth-2-amazon.md | 18 - .../examples/project/update-o-auth-2-apple.md | 20 - .../project/update-o-auth-2-auth-0.md | 19 - .../project/update-o-auth-2-authentik.md | 19 - .../project/update-o-auth-2-autodesk.md | 18 - .../project/update-o-auth-2-bitbucket.md | 18 - .../examples/project/update-o-auth-2-bitly.md | 18 - docs/examples/project/update-o-auth-2-box.md | 18 - .../project/update-o-auth-2-dailymotion.md | 18 - .../project/update-o-auth-2-discord.md | 18 - .../project/update-o-auth-2-disqus.md | 18 - .../project/update-o-auth-2-dropbox.md | 18 - docs/examples/project/update-o-auth-2-etsy.md | 18 - .../project/update-o-auth-2-facebook.md | 18 - .../examples/project/update-o-auth-2-figma.md | 18 - .../project/update-o-auth-2-fusion-auth.md | 19 - .../project/update-o-auth-2-git-hub.md | 18 - .../project/update-o-auth-2-gitlab.md | 19 - .../project/update-o-auth-2-google.md | 19 - .../project/update-o-auth-2-keycloak.md | 20 - docs/examples/project/update-o-auth-2-kick.md | 18 - .../project/update-o-auth-2-linkedin.md | 18 - .../project/update-o-auth-2-microsoft.md | 19 - .../project/update-o-auth-2-notion.md | 18 - docs/examples/project/update-o-auth-2-oidc.md | 22 - docs/examples/project/update-o-auth-2-okta.md | 20 - .../project/update-o-auth-2-paypal-sandbox.md | 18 - .../project/update-o-auth-2-paypal.md | 18 - .../examples/project/update-o-auth-2-podio.md | 18 - .../project/update-o-auth-2-salesforce.md | 18 - .../examples/project/update-o-auth-2-slack.md | 18 - .../project/update-o-auth-2-spotify.md | 18 - .../project/update-o-auth-2-stripe.md | 18 - .../update-o-auth-2-tradeshift-sandbox.md | 18 - .../project/update-o-auth-2-tradeshift.md | 18 - .../project/update-o-auth-2-twitch.md | 18 - .../project/update-o-auth-2-word-press.md | 18 - .../examples/project/update-o-auth-2-yahoo.md | 18 - .../project/update-o-auth-2-yandex.md | 18 - docs/examples/project/update-o-auth-2-zoho.md | 18 - docs/examples/project/update-o-auth-2-zoom.md | 18 - docs/examples/project/update-o-auth-2x.md | 18 - .../update-password-dictionary-policy.md | 16 - .../project/update-password-history-policy.md | 16 - .../update-password-personal-data-policy.md | 16 - docs/examples/project/update-protocol.md | 17 - docs/examples/project/update-service.md | 17 - .../project/update-session-alert-policy.md | 16 - .../project/update-session-duration-policy.md | 16 - .../update-session-invalidation-policy.md | 16 - .../project/update-session-limit-policy.md | 16 - docs/examples/project/update-smtp.md | 25 - .../project/update-user-limit-policy.md | 16 - docs/examples/project/update-variable.md | 19 - docs/examples/project/update-web-platform.md | 18 - .../project/update-windows-platform.md | 18 - docs/examples/proxy/create-api-rule.md | 16 - docs/examples/proxy/create-function-rule.md | 18 - docs/examples/proxy/create-redirect-rule.md | 20 - docs/examples/proxy/create-site-rule.md | 18 - docs/examples/proxy/delete-rule.md | 16 - docs/examples/proxy/get-rule.md | 16 - docs/examples/proxy/list-rules.md | 17 - docs/examples/proxy/update-rule-status.md | 16 - docs/examples/sites/create-deployment.md | 21 - .../sites/create-duplicate-deployment.md | 17 - .../sites/create-template-deployment.md | 22 - docs/examples/sites/create-variable.md | 20 - docs/examples/sites/create-vcs-deployment.md | 19 - docs/examples/sites/create.md | 36 - docs/examples/sites/delete-deployment.md | 17 - docs/examples/sites/delete-log.md | 17 - docs/examples/sites/delete-variable.md | 17 - docs/examples/sites/delete.md | 16 - .../examples/sites/get-deployment-download.md | 18 - docs/examples/sites/get-deployment.md | 17 - docs/examples/sites/get-log.md | 17 - docs/examples/sites/get-variable.md | 17 - docs/examples/sites/get.md | 16 - docs/examples/sites/list-deployments.md | 19 - docs/examples/sites/list-frameworks.md | 14 - docs/examples/sites/list-logs.md | 18 - docs/examples/sites/list-specifications.md | 14 - docs/examples/sites/list-variables.md | 18 - docs/examples/sites/list.md | 18 - .../sites/update-deployment-status.md | 17 - docs/examples/sites/update-site-deployment.md | 17 - docs/examples/sites/update-variable.md | 20 - docs/examples/sites/update.md | 36 - docs/examples/storage/create-bucket.md | 26 - docs/examples/storage/delete-bucket.md | 16 - docs/examples/storage/get-bucket.md | 16 - docs/examples/storage/list-buckets.md | 18 - docs/examples/storage/update-bucket.md | 26 - .../tablesdb/create-big-int-column.md | 23 - .../tablesdb/create-boolean-column.md | 21 - .../tablesdb/create-datetime-column.md | 21 - docs/examples/tablesdb/create-email-column.md | 21 - docs/examples/tablesdb/create-enum-column.md | 22 - docs/examples/tablesdb/create-float-column.md | 23 - docs/examples/tablesdb/create-index.md | 22 - .../tablesdb/create-integer-column.md | 23 - docs/examples/tablesdb/create-ip-column.md | 21 - docs/examples/tablesdb/create-line-column.md | 20 - .../tablesdb/create-longtext-column.md | 22 - .../tablesdb/create-mediumtext-column.md | 22 - docs/examples/tablesdb/create-operations.md | 3 +- docs/examples/tablesdb/create-point-column.md | 20 - .../tablesdb/create-polygon-column.md | 20 - .../tablesdb/create-relationship-column.md | 23 - docs/examples/tablesdb/create-rows.md | 19 - .../examples/tablesdb/create-string-column.md | 23 - docs/examples/tablesdb/create-table.md | 23 - docs/examples/tablesdb/create-text-column.md | 22 - docs/examples/tablesdb/create-transaction.md | 3 +- docs/examples/tablesdb/create-url-column.md | 21 - .../tablesdb/create-varchar-column.md | 23 - docs/examples/tablesdb/create.md | 18 - docs/examples/tablesdb/delete-column.md | 18 - docs/examples/tablesdb/delete-index.md | 18 - docs/examples/tablesdb/delete-rows.md | 19 - docs/examples/tablesdb/delete-table.md | 17 - docs/examples/tablesdb/delete-transaction.md | 3 +- docs/examples/tablesdb/delete.md | 16 - docs/examples/tablesdb/get-column.md | 18 - docs/examples/tablesdb/get-index.md | 18 - docs/examples/tablesdb/get-table.md | 17 - docs/examples/tablesdb/get-transaction.md | 3 +- docs/examples/tablesdb/get.md | 16 - docs/examples/tablesdb/list-columns.md | 19 - docs/examples/tablesdb/list-indexes.md | 19 - docs/examples/tablesdb/list-tables.md | 19 - docs/examples/tablesdb/list-transactions.md | 3 +- docs/examples/tablesdb/list.md | 18 - .../tablesdb/update-big-int-column.md | 23 - .../tablesdb/update-boolean-column.md | 21 - .../tablesdb/update-datetime-column.md | 21 - docs/examples/tablesdb/update-email-column.md | 21 - docs/examples/tablesdb/update-enum-column.md | 22 - docs/examples/tablesdb/update-float-column.md | 23 - .../tablesdb/update-integer-column.md | 23 - docs/examples/tablesdb/update-ip-column.md | 21 - docs/examples/tablesdb/update-line-column.md | 21 - .../tablesdb/update-longtext-column.md | 21 - .../tablesdb/update-mediumtext-column.md | 21 - docs/examples/tablesdb/update-point-column.md | 21 - .../tablesdb/update-polygon-column.md | 21 - .../tablesdb/update-relationship-column.md | 20 - docs/examples/tablesdb/update-rows.md | 26 - .../examples/tablesdb/update-string-column.md | 22 - docs/examples/tablesdb/update-table.md | 22 - docs/examples/tablesdb/update-text-column.md | 21 - docs/examples/tablesdb/update-transaction.md | 3 +- docs/examples/tablesdb/update-url-column.md | 21 - .../tablesdb/update-varchar-column.md | 22 - docs/examples/tablesdb/update.md | 18 - docs/examples/tablesdb/upsert-rows.md | 19 - docs/examples/tokens/create-file-token.md | 18 - docs/examples/tokens/delete.md | 16 - docs/examples/tokens/get.md | 16 - docs/examples/tokens/list.md | 19 - docs/examples/tokens/update.md | 17 - docs/examples/users/create-argon-2-user.md | 19 - docs/examples/users/create-bcrypt-user.md | 19 - docs/examples/users/create-jwt.md | 18 - docs/examples/users/create-md-5-user.md | 19 - .../users/create-mfa-recovery-codes.md | 16 - docs/examples/users/create-ph-pass-user.md | 19 - .../users/create-scrypt-modified-user.md | 22 - docs/examples/users/create-scrypt-user.md | 24 - docs/examples/users/create-session.md | 16 - docs/examples/users/create-sha-user.md | 20 - docs/examples/users/create-target.md | 21 - docs/examples/users/create-token.md | 18 - docs/examples/users/create.md | 20 - docs/examples/users/delete-identity.md | 16 - .../users/delete-mfa-authenticator.md | 17 - docs/examples/users/delete-session.md | 17 - docs/examples/users/delete-sessions.md | 16 - docs/examples/users/delete-target.md | 17 - docs/examples/users/delete.md | 16 - docs/examples/users/get-mfa-recovery-codes.md | 16 - docs/examples/users/get-prefs.md | 16 - docs/examples/users/get-target.md | 17 - docs/examples/users/get.md | 16 - docs/examples/users/list-identities.md | 18 - docs/examples/users/list-logs.md | 18 - docs/examples/users/list-memberships.md | 19 - docs/examples/users/list-mfa-factors.md | 16 - docs/examples/users/list-sessions.md | 17 - docs/examples/users/list-targets.md | 18 - docs/examples/users/list.md | 18 - .../users/update-email-verification.md | 17 - docs/examples/users/update-email.md | 17 - docs/examples/users/update-impersonator.md | 17 - docs/examples/users/update-labels.md | 17 - .../users/update-mfa-recovery-codes.md | 16 - docs/examples/users/update-mfa.md | 17 - docs/examples/users/update-name.md | 17 - docs/examples/users/update-password.md | 17 - .../users/update-phone-verification.md | 17 - docs/examples/users/update-phone.md | 17 - docs/examples/users/update-prefs.md | 17 - docs/examples/users/update-status.md | 17 - docs/examples/users/update-target.md | 20 - docs/examples/webhooks/create.md | 24 - docs/examples/webhooks/delete.md | 16 - docs/examples/webhooks/get.md | 16 - docs/examples/webhooks/list.md | 17 - docs/examples/webhooks/update-secret.md | 17 - docs/examples/webhooks/update.md | 23 - package-lock.json | 4 +- package.json | 2 +- src/channel.ts | 15 +- src/client.ts | 388 +- src/enums/adapter.ts | 4 - src/enums/attribute-status.ts | 7 - src/enums/auth-method.ts | 9 - src/enums/backup-services.ts | 8 - src/enums/build-runtime.ts | 94 - src/enums/column-status.ts | 7 - src/enums/compression.ts | 5 - src/enums/database-type.ts | 6 - src/enums/databases-index-type.ts | 6 - src/enums/deployment-download-type.ts | 4 - src/enums/deployment-status.ts | 8 - src/enums/email-template-locale.ts | 133 - src/enums/email-template-type.ts | 9 - src/enums/framework.ts | 17 - src/enums/health-antivirus-status.ts | 5 - src/enums/health-check-status.ts | 4 - src/enums/index-status.ts | 7 - src/enums/message-priority.ts | 4 - src/enums/message-status.ts | 7 - src/enums/messaging-provider-type.ts | 5 - src/enums/name.ts | 15 - src/enums/o-auth-2-google-prompt.ts | 5 - src/enums/o-auth-provider.ts | 2 - src/enums/order-by.ts | 4 - src/enums/password-hash.ts | 13 - src/enums/platform-type.ts | 7 - src/enums/project-policy.ts | 11 - src/enums/prompt.ts | 5 - src/enums/protocol-id.ts | 5 - src/enums/proxy-resource-type.ts | 4 - .../proxy-rule-deployment-resource-type.ts | 4 - src/enums/proxy-rule-status.ts | 5 - src/enums/relation-mutate.ts | 5 - src/enums/relationship-type.ts | 6 - src/enums/runtime.ts | 94 - src/enums/scopes.ts | 89 - src/enums/secure.ts | 4 - src/enums/service-id.ts | 19 - src/enums/smtp-encryption.ts | 5 - src/enums/status-code.ts | 6 - src/enums/tables-db-index-type.ts | 6 - src/enums/template-reference-type.ts | 5 - src/enums/vcs-reference-type.ts | 5 - src/index.ts | 55 +- src/models.ts | 6533 ++--------------- src/services/account.ts | 304 +- src/services/activities.ts | 123 - src/services/advisor.ts | 255 + src/services/avatars.ts | 48 +- src/services/backups.ts | 761 -- src/services/databases.ts | 5359 +------------- src/services/functions.ts | 1968 +---- src/services/graphql.ts | 25 +- src/services/health.ts | 1050 --- src/services/locale.ts | 25 +- src/services/messaging.ts | 5076 +------------ src/services/presences.ts | 363 + src/services/project.ts | 6443 ---------------- src/services/proxy.ts | 548 -- src/services/realtime.ts | 196 +- src/services/sites.ts | 1925 ----- src/services/storage.ts | 458 +- src/services/tables-db.ts | 5418 +------------- src/services/teams.ts | 25 +- src/services/tokens.ts | 322 - src/services/users.ts | 3277 --------- src/services/webhooks.ts | 473 -- 512 files changed, 2385 insertions(+), 47780 deletions(-) create mode 100644 docs/examples/account/create-o-auth-2-session.md create mode 100644 docs/examples/account/create-push-target.md create mode 100644 docs/examples/account/delete-push-target.md create mode 100644 docs/examples/account/update-push-target.md delete mode 100644 docs/examples/activities/get-event.md delete mode 100644 docs/examples/activities/list-events.md create mode 100644 docs/examples/advisor/get-insight.md create mode 100644 docs/examples/advisor/get-report.md create mode 100644 docs/examples/advisor/list-insights.md create mode 100644 docs/examples/advisor/list-reports.md delete mode 100644 docs/examples/backups/create-archive.md delete mode 100644 docs/examples/backups/create-policy.md delete mode 100644 docs/examples/backups/create-restoration.md delete mode 100644 docs/examples/backups/delete-archive.md delete mode 100644 docs/examples/backups/delete-policy.md delete mode 100644 docs/examples/backups/get-archive.md delete mode 100644 docs/examples/backups/get-policy.md delete mode 100644 docs/examples/backups/get-restoration.md delete mode 100644 docs/examples/backups/list-archives.md delete mode 100644 docs/examples/backups/list-policies.md delete mode 100644 docs/examples/backups/list-restorations.md delete mode 100644 docs/examples/backups/update-policy.md delete mode 100644 docs/examples/databases/create-big-int-attribute.md delete mode 100644 docs/examples/databases/create-boolean-attribute.md delete mode 100644 docs/examples/databases/create-collection.md delete mode 100644 docs/examples/databases/create-datetime-attribute.md delete mode 100644 docs/examples/databases/create-documents.md delete mode 100644 docs/examples/databases/create-email-attribute.md delete mode 100644 docs/examples/databases/create-enum-attribute.md delete mode 100644 docs/examples/databases/create-float-attribute.md delete mode 100644 docs/examples/databases/create-index.md delete mode 100644 docs/examples/databases/create-integer-attribute.md delete mode 100644 docs/examples/databases/create-ip-attribute.md delete mode 100644 docs/examples/databases/create-line-attribute.md delete mode 100644 docs/examples/databases/create-longtext-attribute.md delete mode 100644 docs/examples/databases/create-mediumtext-attribute.md delete mode 100644 docs/examples/databases/create-point-attribute.md delete mode 100644 docs/examples/databases/create-polygon-attribute.md delete mode 100644 docs/examples/databases/create-relationship-attribute.md delete mode 100644 docs/examples/databases/create-string-attribute.md delete mode 100644 docs/examples/databases/create-text-attribute.md delete mode 100644 docs/examples/databases/create-url-attribute.md delete mode 100644 docs/examples/databases/create-varchar-attribute.md delete mode 100644 docs/examples/databases/create.md delete mode 100644 docs/examples/databases/delete-attribute.md delete mode 100644 docs/examples/databases/delete-collection.md delete mode 100644 docs/examples/databases/delete-documents.md delete mode 100644 docs/examples/databases/delete-index.md delete mode 100644 docs/examples/databases/delete.md delete mode 100644 docs/examples/databases/get-attribute.md delete mode 100644 docs/examples/databases/get-collection.md delete mode 100644 docs/examples/databases/get-index.md delete mode 100644 docs/examples/databases/get.md delete mode 100644 docs/examples/databases/list-attributes.md delete mode 100644 docs/examples/databases/list-collections.md delete mode 100644 docs/examples/databases/list-indexes.md delete mode 100644 docs/examples/databases/list.md delete mode 100644 docs/examples/databases/update-big-int-attribute.md delete mode 100644 docs/examples/databases/update-boolean-attribute.md delete mode 100644 docs/examples/databases/update-collection.md delete mode 100644 docs/examples/databases/update-datetime-attribute.md delete mode 100644 docs/examples/databases/update-documents.md delete mode 100644 docs/examples/databases/update-email-attribute.md delete mode 100644 docs/examples/databases/update-enum-attribute.md delete mode 100644 docs/examples/databases/update-float-attribute.md delete mode 100644 docs/examples/databases/update-integer-attribute.md delete mode 100644 docs/examples/databases/update-ip-attribute.md delete mode 100644 docs/examples/databases/update-line-attribute.md delete mode 100644 docs/examples/databases/update-longtext-attribute.md delete mode 100644 docs/examples/databases/update-mediumtext-attribute.md delete mode 100644 docs/examples/databases/update-point-attribute.md delete mode 100644 docs/examples/databases/update-polygon-attribute.md delete mode 100644 docs/examples/databases/update-relationship-attribute.md delete mode 100644 docs/examples/databases/update-string-attribute.md delete mode 100644 docs/examples/databases/update-text-attribute.md delete mode 100644 docs/examples/databases/update-url-attribute.md delete mode 100644 docs/examples/databases/update-varchar-attribute.md delete mode 100644 docs/examples/databases/update.md delete mode 100644 docs/examples/databases/upsert-documents.md delete mode 100644 docs/examples/functions/create-deployment.md delete mode 100644 docs/examples/functions/create-duplicate-deployment.md delete mode 100644 docs/examples/functions/create-template-deployment.md delete mode 100644 docs/examples/functions/create-variable.md delete mode 100644 docs/examples/functions/create-vcs-deployment.md delete mode 100644 docs/examples/functions/create.md delete mode 100644 docs/examples/functions/delete-deployment.md delete mode 100644 docs/examples/functions/delete-execution.md delete mode 100644 docs/examples/functions/delete-variable.md delete mode 100644 docs/examples/functions/delete.md delete mode 100644 docs/examples/functions/get-deployment-download.md delete mode 100644 docs/examples/functions/get-deployment.md delete mode 100644 docs/examples/functions/get-variable.md delete mode 100644 docs/examples/functions/get.md delete mode 100644 docs/examples/functions/list-deployments.md delete mode 100644 docs/examples/functions/list-runtimes.md delete mode 100644 docs/examples/functions/list-specifications.md delete mode 100644 docs/examples/functions/list-variables.md delete mode 100644 docs/examples/functions/list.md delete mode 100644 docs/examples/functions/update-deployment-status.md delete mode 100644 docs/examples/functions/update-function-deployment.md delete mode 100644 docs/examples/functions/update-variable.md delete mode 100644 docs/examples/functions/update.md delete mode 100644 docs/examples/health/get-antivirus.md delete mode 100644 docs/examples/health/get-cache.md delete mode 100644 docs/examples/health/get-certificate.md delete mode 100644 docs/examples/health/get-console-pausing.md delete mode 100644 docs/examples/health/get-db.md delete mode 100644 docs/examples/health/get-failed-jobs.md delete mode 100644 docs/examples/health/get-pub-sub.md delete mode 100644 docs/examples/health/get-queue-audits.md delete mode 100644 docs/examples/health/get-queue-builds.md delete mode 100644 docs/examples/health/get-queue-certificates.md delete mode 100644 docs/examples/health/get-queue-databases.md delete mode 100644 docs/examples/health/get-queue-deletes.md delete mode 100644 docs/examples/health/get-queue-functions.md delete mode 100644 docs/examples/health/get-queue-logs.md delete mode 100644 docs/examples/health/get-queue-mails.md delete mode 100644 docs/examples/health/get-queue-messaging.md delete mode 100644 docs/examples/health/get-queue-migrations.md delete mode 100644 docs/examples/health/get-queue-stats-resources.md delete mode 100644 docs/examples/health/get-queue-usage.md delete mode 100644 docs/examples/health/get-queue-webhooks.md delete mode 100644 docs/examples/health/get-storage-local.md delete mode 100644 docs/examples/health/get-storage.md delete mode 100644 docs/examples/health/get-time.md delete mode 100644 docs/examples/health/get.md delete mode 100644 docs/examples/messaging/create-apns-provider.md delete mode 100644 docs/examples/messaging/create-email.md delete mode 100644 docs/examples/messaging/create-fcm-provider.md delete mode 100644 docs/examples/messaging/create-mailgun-provider.md delete mode 100644 docs/examples/messaging/create-msg-91-provider.md delete mode 100644 docs/examples/messaging/create-push.md delete mode 100644 docs/examples/messaging/create-resend-provider.md delete mode 100644 docs/examples/messaging/create-sendgrid-provider.md delete mode 100644 docs/examples/messaging/create-sms.md delete mode 100644 docs/examples/messaging/create-smtp-provider.md delete mode 100644 docs/examples/messaging/create-telesign-provider.md delete mode 100644 docs/examples/messaging/create-textmagic-provider.md delete mode 100644 docs/examples/messaging/create-topic.md delete mode 100644 docs/examples/messaging/create-twilio-provider.md delete mode 100644 docs/examples/messaging/create-vonage-provider.md delete mode 100644 docs/examples/messaging/delete-provider.md delete mode 100644 docs/examples/messaging/delete-topic.md delete mode 100644 docs/examples/messaging/delete.md delete mode 100644 docs/examples/messaging/get-message.md delete mode 100644 docs/examples/messaging/get-provider.md delete mode 100644 docs/examples/messaging/get-subscriber.md delete mode 100644 docs/examples/messaging/get-topic.md delete mode 100644 docs/examples/messaging/list-message-logs.md delete mode 100644 docs/examples/messaging/list-messages.md delete mode 100644 docs/examples/messaging/list-provider-logs.md delete mode 100644 docs/examples/messaging/list-providers.md delete mode 100644 docs/examples/messaging/list-subscriber-logs.md delete mode 100644 docs/examples/messaging/list-subscribers.md delete mode 100644 docs/examples/messaging/list-targets.md delete mode 100644 docs/examples/messaging/list-topic-logs.md delete mode 100644 docs/examples/messaging/list-topics.md delete mode 100644 docs/examples/messaging/update-apns-provider.md delete mode 100644 docs/examples/messaging/update-email.md delete mode 100644 docs/examples/messaging/update-fcm-provider.md delete mode 100644 docs/examples/messaging/update-mailgun-provider.md delete mode 100644 docs/examples/messaging/update-msg-91-provider.md delete mode 100644 docs/examples/messaging/update-push.md delete mode 100644 docs/examples/messaging/update-resend-provider.md delete mode 100644 docs/examples/messaging/update-sendgrid-provider.md delete mode 100644 docs/examples/messaging/update-sms.md delete mode 100644 docs/examples/messaging/update-smtp-provider.md delete mode 100644 docs/examples/messaging/update-telesign-provider.md delete mode 100644 docs/examples/messaging/update-textmagic-provider.md delete mode 100644 docs/examples/messaging/update-topic.md delete mode 100644 docs/examples/messaging/update-twilio-provider.md delete mode 100644 docs/examples/messaging/update-vonage-provider.md create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update.md create mode 100644 docs/examples/presences/upsert.md delete mode 100644 docs/examples/project/create-android-platform.md delete mode 100644 docs/examples/project/create-apple-platform.md delete mode 100644 docs/examples/project/create-ephemeral-key.md delete mode 100644 docs/examples/project/create-key.md delete mode 100644 docs/examples/project/create-linux-platform.md delete mode 100644 docs/examples/project/create-mock-phone.md delete mode 100644 docs/examples/project/create-smtp-test.md delete mode 100644 docs/examples/project/create-variable.md delete mode 100644 docs/examples/project/create-web-platform.md delete mode 100644 docs/examples/project/create-windows-platform.md delete mode 100644 docs/examples/project/delete-key.md delete mode 100644 docs/examples/project/delete-mock-phone.md delete mode 100644 docs/examples/project/delete-platform.md delete mode 100644 docs/examples/project/delete-variable.md delete mode 100644 docs/examples/project/delete.md delete mode 100644 docs/examples/project/get-email-template.md delete mode 100644 docs/examples/project/get-key.md delete mode 100644 docs/examples/project/get-mock-phone.md delete mode 100644 docs/examples/project/get-o-auth-2-provider.md delete mode 100644 docs/examples/project/get-platform.md delete mode 100644 docs/examples/project/get-policy.md delete mode 100644 docs/examples/project/get-variable.md delete mode 100644 docs/examples/project/list-email-templates.md delete mode 100644 docs/examples/project/list-keys.md delete mode 100644 docs/examples/project/list-mock-phones.md delete mode 100644 docs/examples/project/list-o-auth-2-providers.md delete mode 100644 docs/examples/project/list-platforms.md delete mode 100644 docs/examples/project/list-policies.md delete mode 100644 docs/examples/project/list-variables.md delete mode 100644 docs/examples/project/update-android-platform.md delete mode 100644 docs/examples/project/update-apple-platform.md delete mode 100644 docs/examples/project/update-auth-method.md delete mode 100644 docs/examples/project/update-deny-canonical-email-policy.md delete mode 100644 docs/examples/project/update-deny-disposable-email-policy.md delete mode 100644 docs/examples/project/update-deny-free-email-policy.md delete mode 100644 docs/examples/project/update-email-template.md delete mode 100644 docs/examples/project/update-key.md delete mode 100644 docs/examples/project/update-labels.md delete mode 100644 docs/examples/project/update-linux-platform.md delete mode 100644 docs/examples/project/update-membership-privacy-policy.md delete mode 100644 docs/examples/project/update-mock-phone.md delete mode 100644 docs/examples/project/update-o-auth-2-amazon.md delete mode 100644 docs/examples/project/update-o-auth-2-apple.md delete mode 100644 docs/examples/project/update-o-auth-2-auth-0.md delete mode 100644 docs/examples/project/update-o-auth-2-authentik.md delete mode 100644 docs/examples/project/update-o-auth-2-autodesk.md delete mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md delete mode 100644 docs/examples/project/update-o-auth-2-bitly.md delete mode 100644 docs/examples/project/update-o-auth-2-box.md delete mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md delete mode 100644 docs/examples/project/update-o-auth-2-discord.md delete mode 100644 docs/examples/project/update-o-auth-2-disqus.md delete mode 100644 docs/examples/project/update-o-auth-2-dropbox.md delete mode 100644 docs/examples/project/update-o-auth-2-etsy.md delete mode 100644 docs/examples/project/update-o-auth-2-facebook.md delete mode 100644 docs/examples/project/update-o-auth-2-figma.md delete mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md delete mode 100644 docs/examples/project/update-o-auth-2-git-hub.md delete mode 100644 docs/examples/project/update-o-auth-2-gitlab.md delete mode 100644 docs/examples/project/update-o-auth-2-google.md delete mode 100644 docs/examples/project/update-o-auth-2-keycloak.md delete mode 100644 docs/examples/project/update-o-auth-2-kick.md delete mode 100644 docs/examples/project/update-o-auth-2-linkedin.md delete mode 100644 docs/examples/project/update-o-auth-2-microsoft.md delete mode 100644 docs/examples/project/update-o-auth-2-notion.md delete mode 100644 docs/examples/project/update-o-auth-2-oidc.md delete mode 100644 docs/examples/project/update-o-auth-2-okta.md delete mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md delete mode 100644 docs/examples/project/update-o-auth-2-paypal.md delete mode 100644 docs/examples/project/update-o-auth-2-podio.md delete mode 100644 docs/examples/project/update-o-auth-2-salesforce.md delete mode 100644 docs/examples/project/update-o-auth-2-slack.md delete mode 100644 docs/examples/project/update-o-auth-2-spotify.md delete mode 100644 docs/examples/project/update-o-auth-2-stripe.md delete mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md delete mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md delete mode 100644 docs/examples/project/update-o-auth-2-twitch.md delete mode 100644 docs/examples/project/update-o-auth-2-word-press.md delete mode 100644 docs/examples/project/update-o-auth-2-yahoo.md delete mode 100644 docs/examples/project/update-o-auth-2-yandex.md delete mode 100644 docs/examples/project/update-o-auth-2-zoho.md delete mode 100644 docs/examples/project/update-o-auth-2-zoom.md delete mode 100644 docs/examples/project/update-o-auth-2x.md delete mode 100644 docs/examples/project/update-password-dictionary-policy.md delete mode 100644 docs/examples/project/update-password-history-policy.md delete mode 100644 docs/examples/project/update-password-personal-data-policy.md delete mode 100644 docs/examples/project/update-protocol.md delete mode 100644 docs/examples/project/update-service.md delete mode 100644 docs/examples/project/update-session-alert-policy.md delete mode 100644 docs/examples/project/update-session-duration-policy.md delete mode 100644 docs/examples/project/update-session-invalidation-policy.md delete mode 100644 docs/examples/project/update-session-limit-policy.md delete mode 100644 docs/examples/project/update-smtp.md delete mode 100644 docs/examples/project/update-user-limit-policy.md delete mode 100644 docs/examples/project/update-variable.md delete mode 100644 docs/examples/project/update-web-platform.md delete mode 100644 docs/examples/project/update-windows-platform.md delete mode 100644 docs/examples/proxy/create-api-rule.md delete mode 100644 docs/examples/proxy/create-function-rule.md delete mode 100644 docs/examples/proxy/create-redirect-rule.md delete mode 100644 docs/examples/proxy/create-site-rule.md delete mode 100644 docs/examples/proxy/delete-rule.md delete mode 100644 docs/examples/proxy/get-rule.md delete mode 100644 docs/examples/proxy/list-rules.md delete mode 100644 docs/examples/proxy/update-rule-status.md delete mode 100644 docs/examples/sites/create-deployment.md delete mode 100644 docs/examples/sites/create-duplicate-deployment.md delete mode 100644 docs/examples/sites/create-template-deployment.md delete mode 100644 docs/examples/sites/create-variable.md delete mode 100644 docs/examples/sites/create-vcs-deployment.md delete mode 100644 docs/examples/sites/create.md delete mode 100644 docs/examples/sites/delete-deployment.md delete mode 100644 docs/examples/sites/delete-log.md delete mode 100644 docs/examples/sites/delete-variable.md delete mode 100644 docs/examples/sites/delete.md delete mode 100644 docs/examples/sites/get-deployment-download.md delete mode 100644 docs/examples/sites/get-deployment.md delete mode 100644 docs/examples/sites/get-log.md delete mode 100644 docs/examples/sites/get-variable.md delete mode 100644 docs/examples/sites/get.md delete mode 100644 docs/examples/sites/list-deployments.md delete mode 100644 docs/examples/sites/list-frameworks.md delete mode 100644 docs/examples/sites/list-logs.md delete mode 100644 docs/examples/sites/list-specifications.md delete mode 100644 docs/examples/sites/list-variables.md delete mode 100644 docs/examples/sites/list.md delete mode 100644 docs/examples/sites/update-deployment-status.md delete mode 100644 docs/examples/sites/update-site-deployment.md delete mode 100644 docs/examples/sites/update-variable.md delete mode 100644 docs/examples/sites/update.md delete mode 100644 docs/examples/storage/create-bucket.md delete mode 100644 docs/examples/storage/delete-bucket.md delete mode 100644 docs/examples/storage/get-bucket.md delete mode 100644 docs/examples/storage/list-buckets.md delete mode 100644 docs/examples/storage/update-bucket.md delete mode 100644 docs/examples/tablesdb/create-big-int-column.md delete mode 100644 docs/examples/tablesdb/create-boolean-column.md delete mode 100644 docs/examples/tablesdb/create-datetime-column.md delete mode 100644 docs/examples/tablesdb/create-email-column.md delete mode 100644 docs/examples/tablesdb/create-enum-column.md delete mode 100644 docs/examples/tablesdb/create-float-column.md delete mode 100644 docs/examples/tablesdb/create-index.md delete mode 100644 docs/examples/tablesdb/create-integer-column.md delete mode 100644 docs/examples/tablesdb/create-ip-column.md delete mode 100644 docs/examples/tablesdb/create-line-column.md delete mode 100644 docs/examples/tablesdb/create-longtext-column.md delete mode 100644 docs/examples/tablesdb/create-mediumtext-column.md delete mode 100644 docs/examples/tablesdb/create-point-column.md delete mode 100644 docs/examples/tablesdb/create-polygon-column.md delete mode 100644 docs/examples/tablesdb/create-relationship-column.md delete mode 100644 docs/examples/tablesdb/create-rows.md delete mode 100644 docs/examples/tablesdb/create-string-column.md delete mode 100644 docs/examples/tablesdb/create-table.md delete mode 100644 docs/examples/tablesdb/create-text-column.md delete mode 100644 docs/examples/tablesdb/create-url-column.md delete mode 100644 docs/examples/tablesdb/create-varchar-column.md delete mode 100644 docs/examples/tablesdb/create.md delete mode 100644 docs/examples/tablesdb/delete-column.md delete mode 100644 docs/examples/tablesdb/delete-index.md delete mode 100644 docs/examples/tablesdb/delete-rows.md delete mode 100644 docs/examples/tablesdb/delete-table.md delete mode 100644 docs/examples/tablesdb/delete.md delete mode 100644 docs/examples/tablesdb/get-column.md delete mode 100644 docs/examples/tablesdb/get-index.md delete mode 100644 docs/examples/tablesdb/get-table.md delete mode 100644 docs/examples/tablesdb/get.md delete mode 100644 docs/examples/tablesdb/list-columns.md delete mode 100644 docs/examples/tablesdb/list-indexes.md delete mode 100644 docs/examples/tablesdb/list-tables.md delete mode 100644 docs/examples/tablesdb/list.md delete mode 100644 docs/examples/tablesdb/update-big-int-column.md delete mode 100644 docs/examples/tablesdb/update-boolean-column.md delete mode 100644 docs/examples/tablesdb/update-datetime-column.md delete mode 100644 docs/examples/tablesdb/update-email-column.md delete mode 100644 docs/examples/tablesdb/update-enum-column.md delete mode 100644 docs/examples/tablesdb/update-float-column.md delete mode 100644 docs/examples/tablesdb/update-integer-column.md delete mode 100644 docs/examples/tablesdb/update-ip-column.md delete mode 100644 docs/examples/tablesdb/update-line-column.md delete mode 100644 docs/examples/tablesdb/update-longtext-column.md delete mode 100644 docs/examples/tablesdb/update-mediumtext-column.md delete mode 100644 docs/examples/tablesdb/update-point-column.md delete mode 100644 docs/examples/tablesdb/update-polygon-column.md delete mode 100644 docs/examples/tablesdb/update-relationship-column.md delete mode 100644 docs/examples/tablesdb/update-rows.md delete mode 100644 docs/examples/tablesdb/update-string-column.md delete mode 100644 docs/examples/tablesdb/update-table.md delete mode 100644 docs/examples/tablesdb/update-text-column.md delete mode 100644 docs/examples/tablesdb/update-url-column.md delete mode 100644 docs/examples/tablesdb/update-varchar-column.md delete mode 100644 docs/examples/tablesdb/update.md delete mode 100644 docs/examples/tablesdb/upsert-rows.md delete mode 100644 docs/examples/tokens/create-file-token.md delete mode 100644 docs/examples/tokens/delete.md delete mode 100644 docs/examples/tokens/get.md delete mode 100644 docs/examples/tokens/list.md delete mode 100644 docs/examples/tokens/update.md delete mode 100644 docs/examples/users/create-argon-2-user.md delete mode 100644 docs/examples/users/create-bcrypt-user.md delete mode 100644 docs/examples/users/create-jwt.md delete mode 100644 docs/examples/users/create-md-5-user.md delete mode 100644 docs/examples/users/create-mfa-recovery-codes.md delete mode 100644 docs/examples/users/create-ph-pass-user.md delete mode 100644 docs/examples/users/create-scrypt-modified-user.md delete mode 100644 docs/examples/users/create-scrypt-user.md delete mode 100644 docs/examples/users/create-session.md delete mode 100644 docs/examples/users/create-sha-user.md delete mode 100644 docs/examples/users/create-target.md delete mode 100644 docs/examples/users/create-token.md delete mode 100644 docs/examples/users/create.md delete mode 100644 docs/examples/users/delete-identity.md delete mode 100644 docs/examples/users/delete-mfa-authenticator.md delete mode 100644 docs/examples/users/delete-session.md delete mode 100644 docs/examples/users/delete-sessions.md delete mode 100644 docs/examples/users/delete-target.md delete mode 100644 docs/examples/users/delete.md delete mode 100644 docs/examples/users/get-mfa-recovery-codes.md delete mode 100644 docs/examples/users/get-prefs.md delete mode 100644 docs/examples/users/get-target.md delete mode 100644 docs/examples/users/get.md delete mode 100644 docs/examples/users/list-identities.md delete mode 100644 docs/examples/users/list-logs.md delete mode 100644 docs/examples/users/list-memberships.md delete mode 100644 docs/examples/users/list-mfa-factors.md delete mode 100644 docs/examples/users/list-sessions.md delete mode 100644 docs/examples/users/list-targets.md delete mode 100644 docs/examples/users/list.md delete mode 100644 docs/examples/users/update-email-verification.md delete mode 100644 docs/examples/users/update-email.md delete mode 100644 docs/examples/users/update-impersonator.md delete mode 100644 docs/examples/users/update-labels.md delete mode 100644 docs/examples/users/update-mfa-recovery-codes.md delete mode 100644 docs/examples/users/update-mfa.md delete mode 100644 docs/examples/users/update-name.md delete mode 100644 docs/examples/users/update-password.md delete mode 100644 docs/examples/users/update-phone-verification.md delete mode 100644 docs/examples/users/update-phone.md delete mode 100644 docs/examples/users/update-prefs.md delete mode 100644 docs/examples/users/update-status.md delete mode 100644 docs/examples/users/update-target.md delete mode 100644 docs/examples/webhooks/create.md delete mode 100644 docs/examples/webhooks/delete.md delete mode 100644 docs/examples/webhooks/get.md delete mode 100644 docs/examples/webhooks/list.md delete mode 100644 docs/examples/webhooks/update-secret.md delete mode 100644 docs/examples/webhooks/update.md delete mode 100644 src/enums/adapter.ts delete mode 100644 src/enums/attribute-status.ts delete mode 100644 src/enums/auth-method.ts delete mode 100644 src/enums/backup-services.ts delete mode 100644 src/enums/build-runtime.ts delete mode 100644 src/enums/column-status.ts delete mode 100644 src/enums/compression.ts delete mode 100644 src/enums/database-type.ts delete mode 100644 src/enums/databases-index-type.ts delete mode 100644 src/enums/deployment-download-type.ts delete mode 100644 src/enums/deployment-status.ts delete mode 100644 src/enums/email-template-locale.ts delete mode 100644 src/enums/email-template-type.ts delete mode 100644 src/enums/framework.ts delete mode 100644 src/enums/health-antivirus-status.ts delete mode 100644 src/enums/health-check-status.ts delete mode 100644 src/enums/index-status.ts delete mode 100644 src/enums/message-priority.ts delete mode 100644 src/enums/message-status.ts delete mode 100644 src/enums/messaging-provider-type.ts delete mode 100644 src/enums/name.ts delete mode 100644 src/enums/o-auth-2-google-prompt.ts delete mode 100644 src/enums/order-by.ts delete mode 100644 src/enums/password-hash.ts delete mode 100644 src/enums/platform-type.ts delete mode 100644 src/enums/project-policy.ts delete mode 100644 src/enums/prompt.ts delete mode 100644 src/enums/protocol-id.ts delete mode 100644 src/enums/proxy-resource-type.ts delete mode 100644 src/enums/proxy-rule-deployment-resource-type.ts delete mode 100644 src/enums/proxy-rule-status.ts delete mode 100644 src/enums/relation-mutate.ts delete mode 100644 src/enums/relationship-type.ts delete mode 100644 src/enums/runtime.ts delete mode 100644 src/enums/scopes.ts delete mode 100644 src/enums/secure.ts delete mode 100644 src/enums/service-id.ts delete mode 100644 src/enums/smtp-encryption.ts delete mode 100644 src/enums/status-code.ts delete mode 100644 src/enums/tables-db-index-type.ts delete mode 100644 src/enums/template-reference-type.ts delete mode 100644 src/enums/vcs-reference-type.ts delete mode 100644 src/services/activities.ts create mode 100644 src/services/advisor.ts delete mode 100644 src/services/backups.ts delete mode 100644 src/services/health.ts create mode 100644 src/services/presences.ts delete mode 100644 src/services/project.ts delete mode 100644 src/services/proxy.ts delete mode 100644 src/services/sites.ts delete mode 100644 src/services/tokens.ts delete mode 100644 src/services/users.ts delete mode 100644 src/services/webhooks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d115a2c1..c55ea7bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,13 @@ # Change Log -## 26.0.0 - -* Breaking: Web SDK now generated from the server API spec; package exposes the full server-side service surface (`Users`, `Projects`, `Functions` admin endpoints, `Sites`, `Health`, `Proxy`, `Webhooks`, `Backups`, `Activities`, `Tokens`) in addition to the existing client services -* Added: Isomorphic `Client.from()`, `Client.fromSession()`, `Client.fromAPIKey()`, `Client.fromCookie()`, `Client.fromJWT()`, `Client.fromDevKey()`, and `Client.fromImpersonation()` static factories for use in both browser and server runtimes -* Added: `setCookie()` method on `Client` for forwarding cookies from server runtimes -* Added: `prompt` parameter on `Project.updateOAuth2Google()` plus `Prompt` and `OAuth2GooglePrompt` enums -* Added: `Project.updateDenyCanonicalEmailPolicy()`, `Project.updateDenyDisposableEmailPolicy()`, `Project.updateDenyFreeEmailPolicy()` -* Added: `fusionauth`, `keycloak`, and `kick` to `OAuthProvider` enum -* Updated: `X-Appwrite-Response-Format` header to `1.9.4` -* Updated: `BuildRuntime` and `Runtime` enums with `deno-1.21`, `deno-1.24`, `deno-1.35` +## 25.1.0 + +* Added: Realtime `presences` channel and `RealtimePresence` types for presence subscriptions +* Added: `Advisor` and `Presences` services +* Added: `Insight`, `Presence`, and `Report` models with list variants +* Added: `fusionauth`, `keycloak`, and `kick` providers to `OAuthProvider` enum +* Added: `Client.setCookie()` method for forwarding cookies in server-side runtimes +* Updated: `X-Appwrite-Response-Format` header to `1.9.5` ## 25.0.0 diff --git a/README.md b/README.md index 4a8ec0aa..91363506 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Web SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-web.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) @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services: ```html -<script src="https://cdn.jsdelivr.net/npm/appwrite@26.0.0"></script> +<script src="https://cdn.jsdelivr.net/npm/appwrite@25.1.0"></script> ``` diff --git a/docs/examples/account/create-o-auth-2-session.md b/docs/examples/account/create-o-auth-2-session.md new file mode 100644 index 00000000..734b6972 --- /dev/null +++ b/docs/examples/account/create-o-auth-2-session.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Account, OAuthProvider } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +account.createOAuth2Session({ + provider: OAuthProvider.Amazon, + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [] // optional +}); + +``` diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md new file mode 100644 index 00000000..39f4d48a --- /dev/null +++ b/docs/examples/account/create-push-target.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const result = await account.createPushTarget({ + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md new file mode 100644 index 00000000..38d0ed5a --- /dev/null +++ b/docs/examples/account/delete-push-target.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const result = await account.deletePushTarget({ + targetId: '<TARGET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md new file mode 100644 index 00000000..7c14aa3b --- /dev/null +++ b/docs/examples/account/update-push-target.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const result = await account.updatePushTarget({ + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>' +}); + +console.log(result); +``` diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md deleted file mode 100644 index f6c2fb28..00000000 --- a/docs/examples/activities/get-event.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Activities } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const activities = new Activities(client); - -const result = await activities.getEvent({ - eventId: '<EVENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md deleted file mode 100644 index 0ca7f5fe..00000000 --- a/docs/examples/activities/list-events.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Activities } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const activities = new Activities(client); - -const result = await activities.listEvents({ - queries: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 00000000..28661f98 --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getInsight({ + reportId: '<REPORT_ID>', + insightId: '<INSIGHT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 00000000..79736784 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getReport({ + reportId: '<REPORT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 00000000..c9b8f2ea --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listInsights({ + reportId: '<REPORT_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 00000000..9480e970 --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listReports({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md deleted file mode 100644 index cd437957..00000000 --- a/docs/examples/backups/create-archive.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.createArchive({ - services: [BackupServices.Databases], - resourceId: '<RESOURCE_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md deleted file mode 100644 index 0c4d48c9..00000000 --- a/docs/examples/backups/create-policy.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.createPolicy({ - policyId: '<POLICY_ID>', - services: [BackupServices.Databases], - retention: 1, - schedule: '', - name: '<NAME>', // optional - resourceId: '<RESOURCE_ID>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md deleted file mode 100644 index 9e4f05f8..00000000 --- a/docs/examples/backups/create-restoration.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.createRestoration({ - archiveId: '<ARCHIVE_ID>', - services: [BackupServices.Databases], - newResourceId: '<NEW_RESOURCE_ID>', // optional - newResourceName: '<NEW_RESOURCE_NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md deleted file mode 100644 index 6bcd50e5..00000000 --- a/docs/examples/backups/delete-archive.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.deleteArchive({ - archiveId: '<ARCHIVE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md deleted file mode 100644 index f94cecc5..00000000 --- a/docs/examples/backups/delete-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.deletePolicy({ - policyId: '<POLICY_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md deleted file mode 100644 index 13a6bf8b..00000000 --- a/docs/examples/backups/get-archive.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.getArchive({ - archiveId: '<ARCHIVE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md deleted file mode 100644 index 33f8e829..00000000 --- a/docs/examples/backups/get-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.getPolicy({ - policyId: '<POLICY_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md deleted file mode 100644 index 9638a222..00000000 --- a/docs/examples/backups/get-restoration.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.getRestoration({ - restorationId: '<RESTORATION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md deleted file mode 100644 index 42bd8418..00000000 --- a/docs/examples/backups/list-archives.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.listArchives({ - queries: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md deleted file mode 100644 index cb4fb20a..00000000 --- a/docs/examples/backups/list-policies.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.listPolicies({ - queries: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md deleted file mode 100644 index 9b10280d..00000000 --- a/docs/examples/backups/list-restorations.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.listRestorations({ - queries: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md deleted file mode 100644 index c8dfb9c0..00000000 --- a/docs/examples/backups/update-policy.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const backups = new Backups(client); - -const result = await backups.updatePolicy({ - policyId: '<POLICY_ID>', - name: '<NAME>', // optional - retention: 1, // optional - schedule: '', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md deleted file mode 100644 index 5211fbb7..00000000 --- a/docs/examples/databases/create-big-int-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createBigIntAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md deleted file mode 100644 index 22db05b0..00000000 --- a/docs/examples/databases/create-boolean-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createBooleanAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md deleted file mode 100644 index b10f661a..00000000 --- a/docs/examples/databases/create-collection.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - attributes: [], // optional - indexes: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md deleted file mode 100644 index 07da4465..00000000 --- a/docs/examples/databases/create-datetime-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createDatetimeAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md deleted file mode 100644 index f25f9065..00000000 --- a/docs/examples/databases/create-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documents: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md deleted file mode 100644 index 7e131f87..00000000 --- a/docs/examples/databases/create-email-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createEmailAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md deleted file mode 100644 index 9a8c23ed..00000000 --- a/docs/examples/databases/create-enum-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createEnumAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md deleted file mode 100644 index 8b2a5372..00000000 --- a/docs/examples/databases/create-float-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createFloatAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md deleted file mode 100644 index dfba1599..00000000 --- a/docs/examples/databases/create-index.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases, DatabasesIndexType, OrderBy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - type: DatabasesIndexType.Key, - attributes: [], - orders: [OrderBy.Asc], // optional - lengths: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md deleted file mode 100644 index fbc15919..00000000 --- a/docs/examples/databases/create-integer-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createIntegerAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md deleted file mode 100644 index 7a368a9d..00000000 --- a/docs/examples/databases/create-ip-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createIpAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md deleted file mode 100644 index 4dbb91db..00000000 --- a/docs/examples/databases/create-line-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createLineAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md deleted file mode 100644 index 4bbb6f48..00000000 --- a/docs/examples/databases/create-longtext-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createLongtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md deleted file mode 100644 index e8e72cec..00000000 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createMediumtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 6aba1cf7..48c74718 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md deleted file mode 100644 index ae001017..00000000 --- a/docs/examples/databases/create-point-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createPointAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [1, 2] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md deleted file mode 100644 index cc4ca0b0..00000000 --- a/docs/examples/databases/create-polygon-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createPolygonAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md deleted file mode 100644 index 638d097c..00000000 --- a/docs/examples/databases/create-relationship-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases, RelationshipType, RelationMutate } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createRelationshipAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - relatedCollectionId: '<RELATED_COLLECTION_ID>', - type: RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: RelationMutate.Cascade // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md deleted file mode 100644 index f542d718..00000000 --- a/docs/examples/databases/create-string-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createStringAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md deleted file mode 100644 index 66275d52..00000000 --- a/docs/examples/databases/create-text-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createTextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index 4c5265cb..eab2aa52 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md deleted file mode 100644 index db970a9e..00000000 --- a/docs/examples/databases/create-url-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createUrlAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md deleted file mode 100644 index fede13c8..00000000 --- a/docs/examples/databases/create-varchar-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.createVarcharAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md deleted file mode 100644 index 996365e2..00000000 --- a/docs/examples/databases/create.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.create({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md deleted file mode 100644 index eb426f88..00000000 --- a/docs/examples/databases/delete-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.deleteAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md deleted file mode 100644 index 6a77b190..00000000 --- a/docs/examples/databases/delete-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.deleteCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md deleted file mode 100644 index 1d164615..00000000 --- a/docs/examples/databases/delete-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.deleteDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md deleted file mode 100644 index cd181aba..00000000 --- a/docs/examples/databases/delete-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.deleteIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index cdbccd4b..2e41d9be 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md deleted file mode 100644 index 00477de2..00000000 --- a/docs/examples/databases/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.delete({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md deleted file mode 100644 index 6d3620b1..00000000 --- a/docs/examples/databases/get-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.getAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md deleted file mode 100644 index 537e15b5..00000000 --- a/docs/examples/databases/get-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.getCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md deleted file mode 100644 index 3dbd33bb..00000000 --- a/docs/examples/databases/get-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.getIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 766821f1..2419a8c0 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md deleted file mode 100644 index c15844bf..00000000 --- a/docs/examples/databases/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.get({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md deleted file mode 100644 index a1990ca1..00000000 --- a/docs/examples/databases/list-attributes.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.listAttributes({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md deleted file mode 100644 index d1d68782..00000000 --- a/docs/examples/databases/list-collections.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.listCollections({ - databaseId: '<DATABASE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md deleted file mode 100644 index 3dfb00b3..00000000 --- a/docs/examples/databases/list-indexes.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.listIndexes({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index a8742d63..6a74afc0 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md deleted file mode 100644 index b6880df9..00000000 --- a/docs/examples/databases/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md deleted file mode 100644 index f2963c74..00000000 --- a/docs/examples/databases/update-big-int-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateBigIntAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md deleted file mode 100644 index 6f778dc7..00000000 --- a/docs/examples/databases/update-boolean-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateBooleanAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md deleted file mode 100644 index 66cb382f..00000000 --- a/docs/examples/databases/update-collection.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', // optional - permissions: [Permission.read(Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md deleted file mode 100644 index 19a99e27..00000000 --- a/docs/examples/databases/update-datetime-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateDatetimeAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md deleted file mode 100644 index ec49e33e..00000000 --- a/docs/examples/databases/update-documents.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md deleted file mode 100644 index e93167bb..00000000 --- a/docs/examples/databases/update-email-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateEmailAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md deleted file mode 100644 index 4c8b47cb..00000000 --- a/docs/examples/databases/update-enum-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateEnumAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md deleted file mode 100644 index 02965892..00000000 --- a/docs/examples/databases/update-float-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateFloatAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md deleted file mode 100644 index 93e12509..00000000 --- a/docs/examples/databases/update-integer-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateIntegerAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md deleted file mode 100644 index 7a6c9298..00000000 --- a/docs/examples/databases/update-ip-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateIpAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md deleted file mode 100644 index 2c0e8b00..00000000 --- a/docs/examples/databases/update-line-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateLineAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md deleted file mode 100644 index af9fe747..00000000 --- a/docs/examples/databases/update-longtext-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateLongtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md deleted file mode 100644 index 0203e6cc..00000000 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateMediumtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md deleted file mode 100644 index f53faa5c..00000000 --- a/docs/examples/databases/update-point-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updatePointAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md deleted file mode 100644 index bf3b4acc..00000000 --- a/docs/examples/databases/update-polygon-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updatePolygonAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md deleted file mode 100644 index 05951b5a..00000000 --- a/docs/examples/databases/update-relationship-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases, RelationMutate } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateRelationshipAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - onDelete: RelationMutate.Cascade, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md deleted file mode 100644 index f4495fcb..00000000 --- a/docs/examples/databases/update-string-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateStringAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md deleted file mode 100644 index 4a5dee9c..00000000 --- a/docs/examples/databases/update-text-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateTextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 1e068b9c..5a50ef67 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -3,8 +3,7 @@ import { Client, Databases } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md deleted file mode 100644 index efc001e8..00000000 --- a/docs/examples/databases/update-url-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateUrlAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md deleted file mode 100644 index a72de3a6..00000000 --- a/docs/examples/databases/update-varchar-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.updateVarcharAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md deleted file mode 100644 index a3274f23..00000000 --- a/docs/examples/databases/update.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.update({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md deleted file mode 100644 index a21a7823..00000000 --- a/docs/examples/databases/upsert-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const databases = new Databases(client); - -const result = await databases.upsertDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documents: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md deleted file mode 100644 index c1e9e899..00000000 --- a/docs/examples/functions/create-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.createDeployment({ - functionId: '<FUNCTION_ID>', - code: document.getElementById('uploader').files[0], - activate: false, - entrypoint: '<ENTRYPOINT>', // optional - commands: '<COMMANDS>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md deleted file mode 100644 index fc071792..00000000 --- a/docs/examples/functions/create-duplicate-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.createDuplicateDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', - buildId: '<BUILD_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md deleted file mode 100644 index 644459b7..00000000 --- a/docs/examples/functions/create-template-deployment.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Functions, TemplateReferenceType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.createTemplateDeployment({ - functionId: '<FUNCTION_ID>', - repository: '<REPOSITORY>', - owner: '<OWNER>', - rootDirectory: '<ROOT_DIRECTORY>', - type: TemplateReferenceType.Commit, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md deleted file mode 100644 index 2046356e..00000000 --- a/docs/examples/functions/create-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.createVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md deleted file mode 100644 index 5ab2bd02..00000000 --- a/docs/examples/functions/create-vcs-deployment.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions, VCSReferenceType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.createVcsDeployment({ - functionId: '<FUNCTION_ID>', - type: VCSReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md deleted file mode 100644 index 914637c0..00000000 --- a/docs/examples/functions/create.md +++ /dev/null @@ -1,35 +0,0 @@ -```javascript -import { Client, Functions, Runtime, Scopes } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.create({ - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: Runtime.Node145, - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '<ENTRYPOINT>', // optional - commands: '<COMMANDS>', // optional - scopes: [Scopes.ProjectRead], // optional - installationId: '<INSTALLATION_ID>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md deleted file mode 100644 index 188ca62d..00000000 --- a/docs/examples/functions/delete-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.deleteDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md deleted file mode 100644 index 0f175e35..00000000 --- a/docs/examples/functions/delete-execution.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.deleteExecution({ - functionId: '<FUNCTION_ID>', - executionId: '<EXECUTION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md deleted file mode 100644 index ac367b34..00000000 --- a/docs/examples/functions/delete-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.deleteVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md deleted file mode 100644 index 1fe83049..00000000 --- a/docs/examples/functions/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.delete({ - functionId: '<FUNCTION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md deleted file mode 100644 index 3bfcbf6f..00000000 --- a/docs/examples/functions/get-deployment-download.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions, DeploymentDownloadType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = functions.getDeploymentDownload({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', - type: DeploymentDownloadType.Source // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md deleted file mode 100644 index c200162e..00000000 --- a/docs/examples/functions/get-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.getDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md deleted file mode 100644 index 2e78c6a5..00000000 --- a/docs/examples/functions/get-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.getVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md deleted file mode 100644 index d430fec6..00000000 --- a/docs/examples/functions/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.get({ - functionId: '<FUNCTION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md deleted file mode 100644 index e83ea6f6..00000000 --- a/docs/examples/functions/list-deployments.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.listDeployments({ - functionId: '<FUNCTION_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md deleted file mode 100644 index c10e3ecc..00000000 --- a/docs/examples/functions/list-runtimes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.listRuntimes(); - -console.log(result); -``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md deleted file mode 100644 index 060a7193..00000000 --- a/docs/examples/functions/list-specifications.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.listSpecifications(); - -console.log(result); -``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md deleted file mode 100644 index 21321205..00000000 --- a/docs/examples/functions/list-variables.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.listVariables({ - functionId: '<FUNCTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md deleted file mode 100644 index 6cc31f59..00000000 --- a/docs/examples/functions/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md deleted file mode 100644 index 9d6aa151..00000000 --- a/docs/examples/functions/update-deployment-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.updateDeploymentStatus({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md deleted file mode 100644 index 39479dee..00000000 --- a/docs/examples/functions/update-function-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.updateFunctionDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md deleted file mode 100644 index f1c7c694..00000000 --- a/docs/examples/functions/update-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.updateVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md deleted file mode 100644 index 0900fc5b..00000000 --- a/docs/examples/functions/update.md +++ /dev/null @@ -1,35 +0,0 @@ -```javascript -import { Client, Functions, Runtime, Scopes } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const functions = new Functions(client); - -const result = await functions.update({ - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: Runtime.Node145, // optional - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '<ENTRYPOINT>', // optional - commands: '<COMMANDS>', // optional - scopes: [Scopes.ProjectRead], // optional - installationId: '<INSTALLATION_ID>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 979a108d..a0230ef6 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -3,8 +3,7 @@ import { Client, Graphql } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const graphql = new Graphql(client); diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 62f27815..bef786ab 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -3,8 +3,7 @@ import { Client, Graphql } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const graphql = new Graphql(client); diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md deleted file mode 100644 index b6cc3299..00000000 --- a/docs/examples/health/get-antivirus.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getAntivirus(); - -console.log(result); -``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index 9f0bafbb..00000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getCache(); - -console.log(result); -``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md deleted file mode 100644 index a5764407..00000000 --- a/docs/examples/health/get-certificate.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getCertificate({ - domain: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md deleted file mode 100644 index 7bc69ea4..00000000 --- a/docs/examples/health/get-console-pausing.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getConsolePausing({ - threshold: null, // optional - inactivityDays: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md deleted file mode 100644 index ae3a9d51..00000000 --- a/docs/examples/health/get-db.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getDB(); - -console.log(result); -``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index 0c77a73c..00000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health, Name } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getFailedJobs({ - name: Name.V1Database, - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index d77916b4..00000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getPubSub(); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md deleted file mode 100644 index 1ad7f4e9..00000000 --- a/docs/examples/health/get-queue-audits.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueAudits({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md deleted file mode 100644 index 73cc7693..00000000 --- a/docs/examples/health/get-queue-builds.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueBuilds({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md deleted file mode 100644 index 7c6e56e1..00000000 --- a/docs/examples/health/get-queue-certificates.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueCertificates({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index 2cf4d769..00000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueDatabases({ - name: '<NAME>', // optional - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index bdf63c75..00000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueDeletes({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index e140e4d1..00000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueFunctions({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index 61d4457a..00000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueLogs({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index 5d327c99..00000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueMails({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 5705d9e5..00000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueMessaging({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index 16a6aa37..00000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueMigrations({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md deleted file mode 100644 index b3eaec8e..00000000 --- a/docs/examples/health/get-queue-stats-resources.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueStatsResources({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index d6642e88..00000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueUsage({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index 9caa23eb..00000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getQueueWebhooks({ - threshold: null // optional -}); - -console.log(result); -``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index d8635c01..00000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getStorageLocal(); - -console.log(result); -``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index 8dfa152a..00000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getStorage(); - -console.log(result); -``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index b5a5d99e..00000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.getTime(); - -console.log(result); -``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md deleted file mode 100644 index b146a5cc..00000000 --- a/docs/examples/health/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const health = new Health(client); - -const result = await health.get(); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md deleted file mode 100644 index 1d1f985f..00000000 --- a/docs/examples/messaging/create-apns-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createAPNSProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - authKey: '<AUTH_KEY>', // optional - authKeyId: '<AUTH_KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - bundleId: '<BUNDLE_ID>', // optional - sandbox: false, // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md deleted file mode 100644 index cd8c26ec..00000000 --- a/docs/examples/messaging/create-email.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createEmail({ - messageId: '<MESSAGE_ID>', - subject: '<SUBJECT>', - content: '<CONTENT>', - topics: [], // optional - users: [], // optional - targets: [], // optional - cc: [], // optional - bcc: [], // optional - attachments: [], // optional - draft: false, // optional - html: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md deleted file mode 100644 index 86b2608b..00000000 --- a/docs/examples/messaging/create-fcm-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createFCMProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - serviceAccountJSON: {}, // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md deleted file mode 100644 index 9eb7464b..00000000 --- a/docs/examples/messaging/create-mailgun-provider.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createMailgunProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - domain: '<DOMAIN>', // optional - isEuRegion: false, // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md deleted file mode 100644 index db002142..00000000 --- a/docs/examples/messaging/create-msg-91-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createMsg91Provider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - templateId: '<TEMPLATE_ID>', // optional - senderId: '<SENDER_ID>', // optional - authKey: '<AUTH_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md deleted file mode 100644 index d14b1d47..00000000 --- a/docs/examples/messaging/create-push.md +++ /dev/null @@ -1,34 +0,0 @@ -```javascript -import { Client, Messaging, MessagePriority } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createPush({ - messageId: '<MESSAGE_ID>', - title: '<TITLE>', // optional - body: '<BODY>', // optional - topics: [], // optional - users: [], // optional - targets: [], // optional - data: {}, // optional - action: '<ACTION>', // optional - image: '<ID1:ID2>', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: null, // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - contentAvailable: false, // optional - critical: false, // optional - priority: MessagePriority.Normal // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md deleted file mode 100644 index dae8c132..00000000 --- a/docs/examples/messaging/create-resend-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createResendProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md deleted file mode 100644 index 904505df..00000000 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createSendgridProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md deleted file mode 100644 index e3a528d1..00000000 --- a/docs/examples/messaging/create-sms.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createSMS({ - messageId: '<MESSAGE_ID>', - content: '<CONTENT>', - topics: [], // optional - users: [], // optional - targets: [], // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md deleted file mode 100644 index 7d723827..00000000 --- a/docs/examples/messaging/create-smtp-provider.md +++ /dev/null @@ -1,29 +0,0 @@ -```javascript -import { Client, Messaging, SmtpEncryption } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createSMTPProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - host: '<HOST>', - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: SmtpEncryption.None, // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 6106649d..c29c2f71 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -3,8 +3,7 @@ import { Client, Messaging } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const messaging = new Messaging(client); diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md deleted file mode 100644 index 1b4a133b..00000000 --- a/docs/examples/messaging/create-telesign-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createTelesignProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md deleted file mode 100644 index 83852c55..00000000 --- a/docs/examples/messaging/create-textmagic-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createTextmagicProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md deleted file mode 100644 index e64f0fdb..00000000 --- a/docs/examples/messaging/create-topic.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', - subscribe: ["any"] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md deleted file mode 100644 index 76238497..00000000 --- a/docs/examples/messaging/create-twilio-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createTwilioProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md deleted file mode 100644 index 91ffd288..00000000 --- a/docs/examples/messaging/create-vonage-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.createVonageProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md deleted file mode 100644 index d822d08b..00000000 --- a/docs/examples/messaging/delete-provider.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.deleteProvider({ - providerId: '<PROVIDER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 2eee3367..acd0be51 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -3,8 +3,7 @@ import { Client, Messaging } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const messaging = new Messaging(client); diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md deleted file mode 100644 index 8d93de2f..00000000 --- a/docs/examples/messaging/delete-topic.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.deleteTopic({ - topicId: '<TOPIC_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md deleted file mode 100644 index d9022c37..00000000 --- a/docs/examples/messaging/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.delete({ - messageId: '<MESSAGE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md deleted file mode 100644 index 7f92930f..00000000 --- a/docs/examples/messaging/get-message.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.getMessage({ - messageId: '<MESSAGE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md deleted file mode 100644 index 4375fc3c..00000000 --- a/docs/examples/messaging/get-provider.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.getProvider({ - providerId: '<PROVIDER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md deleted file mode 100644 index daa3294d..00000000 --- a/docs/examples/messaging/get-subscriber.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.getSubscriber({ - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md deleted file mode 100644 index 025f874f..00000000 --- a/docs/examples/messaging/get-topic.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.getTopic({ - topicId: '<TOPIC_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md deleted file mode 100644 index 887d4e3a..00000000 --- a/docs/examples/messaging/list-message-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listMessageLogs({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md deleted file mode 100644 index 5e2cfc43..00000000 --- a/docs/examples/messaging/list-messages.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listMessages({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index f8dab61b..00000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listProviderLogs({ - providerId: '<PROVIDER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md deleted file mode 100644 index 010bd9af..00000000 --- a/docs/examples/messaging/list-providers.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listProviders({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index addd6f35..00000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listSubscriberLogs({ - subscriberId: '<SUBSCRIBER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md deleted file mode 100644 index eb73937d..00000000 --- a/docs/examples/messaging/list-subscribers.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listSubscribers({ - topicId: '<TOPIC_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md deleted file mode 100644 index 528131a0..00000000 --- a/docs/examples/messaging/list-targets.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listTargets({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index 0fa825c7..00000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listTopicLogs({ - topicId: '<TOPIC_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md deleted file mode 100644 index 51d10b0b..00000000 --- a/docs/examples/messaging/list-topics.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.listTopics({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md deleted file mode 100644 index 45b1d6e1..00000000 --- a/docs/examples/messaging/update-apns-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateAPNSProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - authKey: '<AUTH_KEY>', // optional - authKeyId: '<AUTH_KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - bundleId: '<BUNDLE_ID>', // optional - sandbox: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md deleted file mode 100644 index c56e78c0..00000000 --- a/docs/examples/messaging/update-email.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateEmail({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - subject: '<SUBJECT>', // optional - content: '<CONTENT>', // optional - draft: false, // optional - html: false, // optional - cc: [], // optional - bcc: [], // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - attachments: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md deleted file mode 100644 index 392f2c76..00000000 --- a/docs/examples/messaging/update-fcm-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateFCMProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - serviceAccountJSON: {} // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md deleted file mode 100644 index 2eed0f2e..00000000 --- a/docs/examples/messaging/update-mailgun-provider.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateMailgunProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - apiKey: '<API_KEY>', // optional - domain: '<DOMAIN>', // optional - isEuRegion: false, // optional - enabled: false, // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md deleted file mode 100644 index 1f5485bc..00000000 --- a/docs/examples/messaging/update-msg-91-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateMsg91Provider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - templateId: '<TEMPLATE_ID>', // optional - senderId: '<SENDER_ID>', // optional - authKey: '<AUTH_KEY>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md deleted file mode 100644 index 0eee4147..00000000 --- a/docs/examples/messaging/update-push.md +++ /dev/null @@ -1,34 +0,0 @@ -```javascript -import { Client, Messaging, MessagePriority } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updatePush({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - title: '<TITLE>', // optional - body: '<BODY>', // optional - data: {}, // optional - action: '<ACTION>', // optional - image: '<ID1:ID2>', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: null, // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - contentAvailable: false, // optional - critical: false, // optional - priority: MessagePriority.Normal // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md deleted file mode 100644 index c1a5fe9d..00000000 --- a/docs/examples/messaging/update-resend-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateResendProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md deleted file mode 100644 index 847f6c4b..00000000 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateSendgridProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md deleted file mode 100644 index da7feb97..00000000 --- a/docs/examples/messaging/update-sms.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateSMS({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - content: '<CONTENT>', // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md deleted file mode 100644 index f199dc21..00000000 --- a/docs/examples/messaging/update-smtp-provider.md +++ /dev/null @@ -1,29 +0,0 @@ -```javascript -import { Client, Messaging, SmtpEncryption } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateSMTPProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - host: '<HOST>', // optional - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: SmtpEncryption.None, // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md deleted file mode 100644 index 95e99996..00000000 --- a/docs/examples/messaging/update-telesign-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateTelesignProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md deleted file mode 100644 index 800bed36..00000000 --- a/docs/examples/messaging/update-textmagic-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateTextmagicProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md deleted file mode 100644 index bf26e156..00000000 --- a/docs/examples/messaging/update-topic.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', // optional - subscribe: ["any"] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md deleted file mode 100644 index a3abc88a..00000000 --- a/docs/examples/messaging/update-twilio-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateTwilioProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - from: '<FROM>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md deleted file mode 100644 index d4961833..00000000 --- a/docs/examples/messaging/update-vonage-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new Messaging(client); - -const result = await messaging.updateVonageProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - from: '<FROM>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..05d740bb --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Presences } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new Presences(client); + +const result = await presences.delete({ + presenceId: '<PRESENCE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 00000000..dc4f2438 --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Presences } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new Presences(client); + +const result = await presences.get({ + presenceId: '<PRESENCE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 00000000..4e7c8762 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Presences } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new Presences(client); + +const result = await presences.list({ + queries: [], // optional + total: false, // optional + ttl: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md new file mode 100644 index 00000000..79e5aa91 --- /dev/null +++ b/docs/examples/presences/update.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Presences, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new Presences(client); + +const result = await presences.update({ + presenceId: '<PRESENCE_ID>', + status: '<STATUS>', // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {}, // optional + permissions: [Permission.read(Role.any())], // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 00000000..e8fb6349 --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Presences, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new Presences(client); + +const result = await presences.upsert({ + presenceId: '<PRESENCE_ID>', + status: '<STATUS>', + permissions: [Permission.read(Role.any())], // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {} // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md deleted file mode 100644 index 4f5b93e4..00000000 --- a/docs/examples/project/create-android-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md deleted file mode 100644 index bbb7cff0..00000000 --- a/docs/examples/project/create-apple-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md deleted file mode 100644 index a7f09a70..00000000 --- a/docs/examples/project/create-ephemeral-key.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, Scopes } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createEphemeralKey({ - scopes: [Scopes.ProjectRead], - duration: 600 -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md deleted file mode 100644 index fa315fc9..00000000 --- a/docs/examples/project/create-key.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project, Scopes } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [Scopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md deleted file mode 100644 index 85a0051a..00000000 --- a/docs/examples/project/create-linux-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md deleted file mode 100644 index 1f575936..00000000 --- a/docs/examples/project/create-mock-phone.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md deleted file mode 100644 index cc5af160..00000000 --- a/docs/examples/project/create-smtp-test.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createSMTPTest({ - emails: [] -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md deleted file mode 100644 index d8c4406e..00000000 --- a/docs/examples/project/create-variable.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md deleted file mode 100644 index 577065da..00000000 --- a/docs/examples/project/create-web-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); - -console.log(result); -``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md deleted file mode 100644 index a7e7d539..00000000 --- a/docs/examples/project/create-windows-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.createWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md deleted file mode 100644 index 3d66d97e..00000000 --- a/docs/examples/project/delete-key.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.deleteKey({ - keyId: '<KEY_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md deleted file mode 100644 index 711123fb..00000000 --- a/docs/examples/project/delete-mock-phone.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.deleteMockPhone({ - number: '+12065550100' -}); - -console.log(result); -``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md deleted file mode 100644 index 16dc5ddf..00000000 --- a/docs/examples/project/delete-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.deletePlatform({ - platformId: '<PLATFORM_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md deleted file mode 100644 index a3eb41a2..00000000 --- a/docs/examples/project/delete-variable.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.deleteVariable({ - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md deleted file mode 100644 index c6b7efee..00000000 --- a/docs/examples/project/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.delete(); - -console.log(result); -``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md deleted file mode 100644 index fbb713ef..00000000 --- a/docs/examples/project/get-email-template.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, EmailTemplateType, EmailTemplateLocale } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getEmailTemplate({ - templateId: EmailTemplateType.Verification, - locale: EmailTemplateLocale.Af // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md deleted file mode 100644 index db0be391..00000000 --- a/docs/examples/project/get-key.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getKey({ - keyId: '<KEY_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md deleted file mode 100644 index dadfda25..00000000 --- a/docs/examples/project/get-mock-phone.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getMockPhone({ - number: '+12065550100' -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md deleted file mode 100644 index e1b23650..00000000 --- a/docs/examples/project/get-o-auth-2-provider.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project, OAuthProvider } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getOAuth2Provider({ - providerId: OAuthProvider.Amazon -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md deleted file mode 100644 index 56d73893..00000000 --- a/docs/examples/project/get-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getPlatform({ - platformId: '<PLATFORM_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md deleted file mode 100644 index 9b65db9f..00000000 --- a/docs/examples/project/get-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project, ProjectPolicy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getPolicy({ - policyId: ProjectPolicy.PasswordDictionary -}); - -console.log(result); -``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md deleted file mode 100644 index 6e1250a1..00000000 --- a/docs/examples/project/get-variable.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.getVariable({ - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md deleted file mode 100644 index f9ca4934..00000000 --- a/docs/examples/project/list-email-templates.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listEmailTemplates({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md deleted file mode 100644 index 3fdd792a..00000000 --- a/docs/examples/project/list-keys.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listKeys({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md deleted file mode 100644 index 1431ac99..00000000 --- a/docs/examples/project/list-mock-phones.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listMockPhones({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md deleted file mode 100644 index ac931830..00000000 --- a/docs/examples/project/list-o-auth-2-providers.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listOAuth2Providers({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md deleted file mode 100644 index 57186cdd..00000000 --- a/docs/examples/project/list-platforms.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listPlatforms({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md deleted file mode 100644 index a71dbd3d..00000000 --- a/docs/examples/project/list-policies.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listPolicies({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md deleted file mode 100644 index 7f2f413b..00000000 --- a/docs/examples/project/list-variables.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.listVariables({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md deleted file mode 100644 index b763954f..00000000 --- a/docs/examples/project/update-android-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md deleted file mode 100644 index 9d8d4e84..00000000 --- a/docs/examples/project/update-apple-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md deleted file mode 100644 index e7b31bf4..00000000 --- a/docs/examples/project/update-auth-method.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, AuthMethod } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateAuthMethod({ - methodId: AuthMethod.EmailPassword, - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-deny-canonical-email-policy.md b/docs/examples/project/update-deny-canonical-email-policy.md deleted file mode 100644 index 05da6cd1..00000000 --- a/docs/examples/project/update-deny-canonical-email-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateDenyCanonicalEmailPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md deleted file mode 100644 index 7018f494..00000000 --- a/docs/examples/project/update-deny-disposable-email-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateDenyDisposableEmailPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md deleted file mode 100644 index e6a223d7..00000000 --- a/docs/examples/project/update-deny-free-email-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateDenyFreeEmailPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md deleted file mode 100644 index 42afcb0e..00000000 --- a/docs/examples/project/update-email-template.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Project, EmailTemplateType, EmailTemplateLocale } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateEmailTemplate({ - templateId: EmailTemplateType.Verification, - locale: EmailTemplateLocale.Af, // optional - subject: '<SUBJECT>', // optional - message: '<MESSAGE>', // optional - senderName: '<SENDER_NAME>', // optional - senderEmail: 'email@example.com', // optional - replyToEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md deleted file mode 100644 index 505c1f25..00000000 --- a/docs/examples/project/update-key.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project, Scopes } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [Scopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md deleted file mode 100644 index 67f33ac1..00000000 --- a/docs/examples/project/update-labels.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateLabels({ - labels: [] -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md deleted file mode 100644 index 92156ecb..00000000 --- a/docs/examples/project/update-linux-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md deleted file mode 100644 index 2919e5ee..00000000 --- a/docs/examples/project/update-membership-privacy-policy.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateMembershipPrivacyPolicy({ - userId: false, // optional - userEmail: false, // optional - userPhone: false, // optional - userName: false, // optional - userMFA: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md deleted file mode 100644 index 64afb02f..00000000 --- a/docs/examples/project/update-mock-phone.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md deleted file mode 100644 index 54ba34cd..00000000 --- a/docs/examples/project/update-o-auth-2-amazon.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Amazon({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md deleted file mode 100644 index 79abec83..00000000 --- a/docs/examples/project/update-o-auth-2-apple.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Apple({ - serviceId: '<SERVICE_ID>', // optional - keyId: '<KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - p8File: '<P8_FILE>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md deleted file mode 100644 index b0e14b38..00000000 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Auth0({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md deleted file mode 100644 index 934587ef..00000000 --- a/docs/examples/project/update-o-auth-2-authentik.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Authentik({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md deleted file mode 100644 index 46d1c2a1..00000000 --- a/docs/examples/project/update-o-auth-2-autodesk.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Autodesk({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md deleted file mode 100644 index 5dfeafe1..00000000 --- a/docs/examples/project/update-o-auth-2-bitbucket.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Bitbucket({ - key: '<KEY>', // optional - secret: '<SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md deleted file mode 100644 index b50d2c40..00000000 --- a/docs/examples/project/update-o-auth-2-bitly.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Bitly({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md deleted file mode 100644 index 2075de35..00000000 --- a/docs/examples/project/update-o-auth-2-box.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Box({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md deleted file mode 100644 index 5684566d..00000000 --- a/docs/examples/project/update-o-auth-2-dailymotion.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Dailymotion({ - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md deleted file mode 100644 index 599cbc01..00000000 --- a/docs/examples/project/update-o-auth-2-discord.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Discord({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md deleted file mode 100644 index 9f925148..00000000 --- a/docs/examples/project/update-o-auth-2-disqus.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Disqus({ - publicKey: '<PUBLIC_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md deleted file mode 100644 index 720fb731..00000000 --- a/docs/examples/project/update-o-auth-2-dropbox.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Dropbox({ - appKey: '<APP_KEY>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md deleted file mode 100644 index b01acffb..00000000 --- a/docs/examples/project/update-o-auth-2-etsy.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Etsy({ - keyString: '<KEY_STRING>', // optional - sharedSecret: '<SHARED_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md deleted file mode 100644 index b96867de..00000000 --- a/docs/examples/project/update-o-auth-2-facebook.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Facebook({ - appId: '<APP_ID>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md deleted file mode 100644 index b22912e2..00000000 --- a/docs/examples/project/update-o-auth-2-figma.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Figma({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md deleted file mode 100644 index ca64f4dd..00000000 --- a/docs/examples/project/update-o-auth-2-fusion-auth.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2FusionAuth({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md deleted file mode 100644 index 25fd6e12..00000000 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2GitHub({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md deleted file mode 100644 index 06a0a71f..00000000 --- a/docs/examples/project/update-o-auth-2-gitlab.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Gitlab({ - applicationId: '<APPLICATION_ID>', // optional - secret: '<SECRET>', // optional - endpoint: 'https://example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md deleted file mode 100644 index ba27dfe8..00000000 --- a/docs/examples/project/update-o-auth-2-google.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project, Prompt } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Google({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - prompt: [Prompt.None], // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md deleted file mode 100644 index ed69fcfd..00000000 --- a/docs/examples/project/update-o-auth-2-keycloak.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Keycloak({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - realmName: '<REALM_NAME>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md deleted file mode 100644 index 22e0b7a8..00000000 --- a/docs/examples/project/update-o-auth-2-kick.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Kick({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md deleted file mode 100644 index c3949782..00000000 --- a/docs/examples/project/update-o-auth-2-linkedin.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Linkedin({ - clientId: '<CLIENT_ID>', // optional - primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md deleted file mode 100644 index 98d75a12..00000000 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Microsoft({ - applicationId: '<APPLICATION_ID>', // optional - applicationSecret: '<APPLICATION_SECRET>', // optional - tenant: '<TENANT>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md deleted file mode 100644 index 24391ce9..00000000 --- a/docs/examples/project/update-o-auth-2-notion.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Notion({ - oauthClientId: '<OAUTH_CLIENT_ID>', // optional - oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md deleted file mode 100644 index 75da5672..00000000 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Oidc({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - wellKnownURL: 'https://example.com', // optional - authorizationURL: 'https://example.com', // optional - tokenURL: 'https://example.com', // optional - userInfoURL: 'https://example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md deleted file mode 100644 index 406382af..00000000 --- a/docs/examples/project/update-o-auth-2-okta.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Okta({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - domain: '', // optional - authorizationServerId: '<AUTHORIZATION_SERVER_ID>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md deleted file mode 100644 index dcc2959d..00000000 --- a/docs/examples/project/update-o-auth-2-paypal-sandbox.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2PaypalSandbox({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md deleted file mode 100644 index 6f0650ef..00000000 --- a/docs/examples/project/update-o-auth-2-paypal.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Paypal({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md deleted file mode 100644 index ba2de8e6..00000000 --- a/docs/examples/project/update-o-auth-2-podio.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Podio({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md deleted file mode 100644 index 41cecbbc..00000000 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Salesforce({ - customerKey: '<CUSTOMER_KEY>', // optional - customerSecret: '<CUSTOMER_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md deleted file mode 100644 index 3ed48cb0..00000000 --- a/docs/examples/project/update-o-auth-2-slack.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Slack({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md deleted file mode 100644 index 63e3f67e..00000000 --- a/docs/examples/project/update-o-auth-2-spotify.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Spotify({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md deleted file mode 100644 index 2fb44b1d..00000000 --- a/docs/examples/project/update-o-auth-2-stripe.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Stripe({ - clientId: '<CLIENT_ID>', // optional - apiSecretKey: '<API_SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md deleted file mode 100644 index 2db30540..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2TradeshiftSandbox({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md deleted file mode 100644 index 0ff91ada..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Tradeshift({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md deleted file mode 100644 index 243e9c15..00000000 --- a/docs/examples/project/update-o-auth-2-twitch.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Twitch({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md deleted file mode 100644 index 74c99a5c..00000000 --- a/docs/examples/project/update-o-auth-2-word-press.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2WordPress({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md deleted file mode 100644 index 341f827d..00000000 --- a/docs/examples/project/update-o-auth-2-yahoo.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Yahoo({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md deleted file mode 100644 index a98b6b5d..00000000 --- a/docs/examples/project/update-o-auth-2-yandex.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Yandex({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md deleted file mode 100644 index 1bbb53e7..00000000 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Zoho({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md deleted file mode 100644 index 8dd33d6d..00000000 --- a/docs/examples/project/update-o-auth-2-zoom.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2Zoom({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md deleted file mode 100644 index d8e9f514..00000000 --- a/docs/examples/project/update-o-auth-2x.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateOAuth2X({ - customerKey: '<CUSTOMER_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md deleted file mode 100644 index 7174d60a..00000000 --- a/docs/examples/project/update-password-dictionary-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updatePasswordDictionaryPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md deleted file mode 100644 index 89f56e22..00000000 --- a/docs/examples/project/update-password-history-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updatePasswordHistoryPolicy({ - total: 1 -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md deleted file mode 100644 index 35039c4d..00000000 --- a/docs/examples/project/update-password-personal-data-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updatePasswordPersonalDataPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md deleted file mode 100644 index 47f91807..00000000 --- a/docs/examples/project/update-protocol.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, ProtocolId } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateProtocol({ - protocolId: ProtocolId.Rest, - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md deleted file mode 100644 index bc9e78a4..00000000 --- a/docs/examples/project/update-service.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, ServiceId } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateService({ - serviceId: ServiceId.Account, - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md deleted file mode 100644 index 99c3d437..00000000 --- a/docs/examples/project/update-session-alert-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateSessionAlertPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md deleted file mode 100644 index b17eda43..00000000 --- a/docs/examples/project/update-session-duration-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateSessionDurationPolicy({ - duration: 5 -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md deleted file mode 100644 index 17e1e367..00000000 --- a/docs/examples/project/update-session-invalidation-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateSessionInvalidationPolicy({ - enabled: false -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md deleted file mode 100644 index df33c446..00000000 --- a/docs/examples/project/update-session-limit-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateSessionLimitPolicy({ - total: 1 -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md deleted file mode 100644 index 42a022a7..00000000 --- a/docs/examples/project/update-smtp.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -import { Client, Project, Secure } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateSMTP({ - host: '', // optional - port: null, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - senderEmail: 'email@example.com', // optional - senderName: '<SENDER_NAME>', // optional - replyToEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - secure: Secure.Tls, // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md deleted file mode 100644 index a21f30e0..00000000 --- a/docs/examples/project/update-user-limit-policy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateUserLimitPolicy({ - total: 1 -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md deleted file mode 100644 index c7a542d0..00000000 --- a/docs/examples/project/update-variable.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md deleted file mode 100644 index 7b0e74f1..00000000 --- a/docs/examples/project/update-web-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); - -console.log(result); -``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md deleted file mode 100644 index 6fdb62b6..00000000 --- a/docs/examples/project/update-windows-platform.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new Project(client); - -const result = await project.updateWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md deleted file mode 100644 index 69c7459a..00000000 --- a/docs/examples/proxy/create-api-rule.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.createAPIRule({ - domain: '' -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md deleted file mode 100644 index 5491f090..00000000 --- a/docs/examples/proxy/create-function-rule.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.createFunctionRule({ - domain: '', - functionId: '<FUNCTION_ID>', - branch: '<BRANCH>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md deleted file mode 100644 index 7cca57c6..00000000 --- a/docs/examples/proxy/create-redirect-rule.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Proxy, StatusCode, ProxyResourceType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.createRedirectRule({ - domain: '', - url: 'https://example.com', - statusCode: StatusCode.MovedPermanently301, - resourceId: '<RESOURCE_ID>', - resourceType: ProxyResourceType.Site -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md deleted file mode 100644 index ca443e1d..00000000 --- a/docs/examples/proxy/create-site-rule.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.createSiteRule({ - domain: '', - siteId: '<SITE_ID>', - branch: '<BRANCH>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md deleted file mode 100644 index 414d0636..00000000 --- a/docs/examples/proxy/delete-rule.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.deleteRule({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md deleted file mode 100644 index 21798206..00000000 --- a/docs/examples/proxy/get-rule.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.getRule({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md deleted file mode 100644 index e119ccd7..00000000 --- a/docs/examples/proxy/list-rules.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.listRules({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md deleted file mode 100644 index 912a8c74..00000000 --- a/docs/examples/proxy/update-rule-status.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new Proxy(client); - -const result = await proxy.updateRuleStatus({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md deleted file mode 100644 index 92c3ed83..00000000 --- a/docs/examples/sites/create-deployment.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.createDeployment({ - siteId: '<SITE_ID>', - code: document.getElementById('uploader').files[0], - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - activate: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md deleted file mode 100644 index 44b28e9b..00000000 --- a/docs/examples/sites/create-duplicate-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.createDuplicateDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md deleted file mode 100644 index a0b65d3c..00000000 --- a/docs/examples/sites/create-template-deployment.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Sites, TemplateReferenceType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.createTemplateDeployment({ - siteId: '<SITE_ID>', - repository: '<REPOSITORY>', - owner: '<OWNER>', - rootDirectory: '<ROOT_DIRECTORY>', - type: TemplateReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md deleted file mode 100644 index ac097f08..00000000 --- a/docs/examples/sites/create-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.createVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md deleted file mode 100644 index 29c7e9a0..00000000 --- a/docs/examples/sites/create-vcs-deployment.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites, VCSReferenceType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.createVcsDeployment({ - siteId: '<SITE_ID>', - type: VCSReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md deleted file mode 100644 index 077ff02b..00000000 --- a/docs/examples/sites/create.md +++ /dev/null @@ -1,36 +0,0 @@ -```javascript -import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.create({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: Framework.Analog, - buildRuntime: BuildRuntime.Node145, - enabled: false, // optional - logging: false, // optional - timeout: 1, // optional - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - startCommand: '<START_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - adapter: Adapter.Static, // optional - installationId: '<INSTALLATION_ID>', // optional - fallbackFile: '<FALLBACK_FILE>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md deleted file mode 100644 index 4946b410..00000000 --- a/docs/examples/sites/delete-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.deleteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md deleted file mode 100644 index 70b9c5b6..00000000 --- a/docs/examples/sites/delete-log.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.deleteLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md deleted file mode 100644 index b9765373..00000000 --- a/docs/examples/sites/delete-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.deleteVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md deleted file mode 100644 index 536787c2..00000000 --- a/docs/examples/sites/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.delete({ - siteId: '<SITE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md deleted file mode 100644 index 11e8f1b7..00000000 --- a/docs/examples/sites/get-deployment-download.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites, DeploymentDownloadType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = sites.getDeploymentDownload({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>', - type: DeploymentDownloadType.Source // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md deleted file mode 100644 index 4a2a09e4..00000000 --- a/docs/examples/sites/get-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.getDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md deleted file mode 100644 index 3b659154..00000000 --- a/docs/examples/sites/get-log.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.getLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md deleted file mode 100644 index 3f76531a..00000000 --- a/docs/examples/sites/get-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.getVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md deleted file mode 100644 index 5a932f86..00000000 --- a/docs/examples/sites/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.get({ - siteId: '<SITE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md deleted file mode 100644 index 6550104b..00000000 --- a/docs/examples/sites/list-deployments.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.listDeployments({ - siteId: '<SITE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md deleted file mode 100644 index cc97c464..00000000 --- a/docs/examples/sites/list-frameworks.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.listFrameworks(); - -console.log(result); -``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md deleted file mode 100644 index 4e6d399b..00000000 --- a/docs/examples/sites/list-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.listLogs({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md deleted file mode 100644 index 49542d33..00000000 --- a/docs/examples/sites/list-specifications.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.listSpecifications(); - -console.log(result); -``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md deleted file mode 100644 index debe474b..00000000 --- a/docs/examples/sites/list-variables.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.listVariables({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md deleted file mode 100644 index f23917ff..00000000 --- a/docs/examples/sites/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md deleted file mode 100644 index 1c0cf9ac..00000000 --- a/docs/examples/sites/update-deployment-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.updateDeploymentStatus({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md deleted file mode 100644 index e0d9b815..00000000 --- a/docs/examples/sites/update-site-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.updateSiteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md deleted file mode 100644 index 7d38c44b..00000000 --- a/docs/examples/sites/update-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.updateVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md deleted file mode 100644 index 3e112a49..00000000 --- a/docs/examples/sites/update.md +++ /dev/null @@ -1,36 +0,0 @@ -```javascript -import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new Sites(client); - -const result = await sites.update({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: Framework.Analog, - enabled: false, // optional - logging: false, // optional - timeout: 1, // optional - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - startCommand: '<START_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - buildRuntime: BuildRuntime.Node145, // optional - adapter: Adapter.Static, // optional - fallbackFile: '<FALLBACK_FILE>', // optional - installationId: '<INSTALLATION_ID>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md deleted file mode 100644 index caa0f5f4..00000000 --- a/docs/examples/storage/create-bucket.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Storage, Compression, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new Storage(client); - -const result = await storage.createBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md deleted file mode 100644 index dcdd5b9d..00000000 --- a/docs/examples/storage/delete-bucket.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new Storage(client); - -const result = await storage.deleteBucket({ - bucketId: '<BUCKET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md deleted file mode 100644 index 34209f73..00000000 --- a/docs/examples/storage/get-bucket.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new Storage(client); - -const result = await storage.getBucket({ - bucketId: '<BUCKET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md deleted file mode 100644 index 213f49fb..00000000 --- a/docs/examples/storage/list-buckets.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new Storage(client); - -const result = await storage.listBuckets({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md deleted file mode 100644 index d1d3d217..00000000 --- a/docs/examples/storage/update-bucket.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Storage, Compression, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new Storage(client); - -const result = await storage.updateBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md deleted file mode 100644 index 4e6de6e4..00000000 --- a/docs/examples/tablesdb/create-big-int-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createBigIntColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md deleted file mode 100644 index 46587633..00000000 --- a/docs/examples/tablesdb/create-boolean-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md deleted file mode 100644 index 0fa4bf54..00000000 --- a/docs/examples/tablesdb/create-datetime-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createDatetimeColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md deleted file mode 100644 index b0e8f556..00000000 --- a/docs/examples/tablesdb/create-email-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md deleted file mode 100644 index 38b8a1e1..00000000 --- a/docs/examples/tablesdb/create-enum-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md deleted file mode 100644 index b79de08a..00000000 --- a/docs/examples/tablesdb/create-float-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createFloatColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md deleted file mode 100644 index 577b4298..00000000 --- a/docs/examples/tablesdb/create-index.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB, TablesDBIndexType, OrderBy } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - type: TablesDBIndexType.Key, - columns: [], - orders: [OrderBy.Asc], // optional - lengths: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md deleted file mode 100644 index aebb42d9..00000000 --- a/docs/examples/tablesdb/create-integer-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createIntegerColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md deleted file mode 100644 index 8f3b9b9c..00000000 --- a/docs/examples/tablesdb/create-ip-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md deleted file mode 100644 index b75db329..00000000 --- a/docs/examples/tablesdb/create-line-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createLineColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md deleted file mode 100644 index 32d8c155..00000000 --- a/docs/examples/tablesdb/create-longtext-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createLongtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md deleted file mode 100644 index 1ba3db8a..00000000 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createMediumtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index f73f91c4..739b4e62 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md deleted file mode 100644 index 388d2b7f..00000000 --- a/docs/examples/tablesdb/create-point-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createPointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md deleted file mode 100644 index 932c9eb8..00000000 --- a/docs/examples/tablesdb/create-polygon-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createPolygonColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md deleted file mode 100644 index 3fce5eeb..00000000 --- a/docs/examples/tablesdb/create-relationship-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB, RelationshipType, RelationMutate } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - relatedTableId: '<RELATED_TABLE_ID>', - type: RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: RelationMutate.Cascade // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md deleted file mode 100644 index 8b649750..00000000 --- a/docs/examples/tablesdb/create-rows.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md deleted file mode 100644 index fa49a7e1..00000000 --- a/docs/examples/tablesdb/create-string-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createStringColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md deleted file mode 100644 index 573e4029..00000000 --- a/docs/examples/tablesdb/create-table.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - columns: [], // optional - indexes: [] // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md deleted file mode 100644 index a0ef3269..00000000 --- a/docs/examples/tablesdb/create-text-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createTextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 199d150a..333eb80e 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md deleted file mode 100644 index 860f53c4..00000000 --- a/docs/examples/tablesdb/create-url-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md deleted file mode 100644 index b1a1c1ec..00000000 --- a/docs/examples/tablesdb/create-varchar-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createVarcharColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md deleted file mode 100644 index b9e8a426..00000000 --- a/docs/examples/tablesdb/create.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.create({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md deleted file mode 100644 index 3ea6ea65..00000000 --- a/docs/examples/tablesdb/delete-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md deleted file mode 100644 index b6315007..00000000 --- a/docs/examples/tablesdb/delete-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md deleted file mode 100644 index 7b5ba0a5..00000000 --- a/docs/examples/tablesdb/delete-rows.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md deleted file mode 100644 index 672c7d4b..00000000 --- a/docs/examples/tablesdb/delete-table.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index f2c49810..0c98481c 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md deleted file mode 100644 index 1356ff93..00000000 --- a/docs/examples/tablesdb/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.delete({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md deleted file mode 100644 index ae1c9eb7..00000000 --- a/docs/examples/tablesdb/get-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md deleted file mode 100644 index 621debde..00000000 --- a/docs/examples/tablesdb/get-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md deleted file mode 100644 index aa099413..00000000 --- a/docs/examples/tablesdb/get-table.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 7f8a50df..00e72497 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md deleted file mode 100644 index 08460715..00000000 --- a/docs/examples/tablesdb/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.get({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md deleted file mode 100644 index a314e1d8..00000000 --- a/docs/examples/tablesdb/list-columns.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listColumns({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md deleted file mode 100644 index fcddddb8..00000000 --- a/docs/examples/tablesdb/list-indexes.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listIndexes({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md deleted file mode 100644 index 4c439657..00000000 --- a/docs/examples/tablesdb/list-tables.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listTables({ - databaseId: '<DATABASE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index c575a7fc..b6448518 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md deleted file mode 100644 index 607e5b5e..00000000 --- a/docs/examples/tablesdb/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md deleted file mode 100644 index 1ef1adf3..00000000 --- a/docs/examples/tablesdb/update-big-int-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateBigIntColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md deleted file mode 100644 index 7059d711..00000000 --- a/docs/examples/tablesdb/update-boolean-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md deleted file mode 100644 index 62c4135f..00000000 --- a/docs/examples/tablesdb/update-datetime-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateDatetimeColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md deleted file mode 100644 index 5a844ea1..00000000 --- a/docs/examples/tablesdb/update-email-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md deleted file mode 100644 index 694faa50..00000000 --- a/docs/examples/tablesdb/update-enum-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md deleted file mode 100644 index 8fbb3226..00000000 --- a/docs/examples/tablesdb/update-float-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateFloatColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md deleted file mode 100644 index 686df6d8..00000000 --- a/docs/examples/tablesdb/update-integer-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateIntegerColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md deleted file mode 100644 index 471f213e..00000000 --- a/docs/examples/tablesdb/update-ip-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md deleted file mode 100644 index ba7cb549..00000000 --- a/docs/examples/tablesdb/update-line-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateLineColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md deleted file mode 100644 index f87f9398..00000000 --- a/docs/examples/tablesdb/update-longtext-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateLongtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md deleted file mode 100644 index 6bcfef3a..00000000 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateMediumtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md deleted file mode 100644 index 3ce5186d..00000000 --- a/docs/examples/tablesdb/update-point-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updatePointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md deleted file mode 100644 index 997bf18c..00000000 --- a/docs/examples/tablesdb/update-polygon-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updatePolygonColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md deleted file mode 100644 index 89cca3d4..00000000 --- a/docs/examples/tablesdb/update-relationship-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB, RelationMutate } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - onDelete: RelationMutate.Cascade, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md deleted file mode 100644 index 73b59c2c..00000000 --- a/docs/examples/tablesdb/update-rows.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md deleted file mode 100644 index 870d0ca0..00000000 --- a/docs/examples/tablesdb/update-string-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateStringColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md deleted file mode 100644 index 0cdda11b..00000000 --- a/docs/examples/tablesdb/update-table.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', // optional - permissions: [Permission.read(Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md deleted file mode 100644 index 6071843b..00000000 --- a/docs/examples/tablesdb/update-text-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateTextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index 323adc7b..80a8b89d 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -3,8 +3,7 @@ import { Client, TablesDB } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md deleted file mode 100644 index c300f6a1..00000000 --- a/docs/examples/tablesdb/update-url-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md deleted file mode 100644 index 652abf19..00000000 --- a/docs/examples/tablesdb/update-varchar-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateVarcharColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md deleted file mode 100644 index e618ce90..00000000 --- a/docs/examples/tablesdb/update.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.update({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', // optional - enabled: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md deleted file mode 100644 index edf4e3bd..00000000 --- a/docs/examples/tablesdb/upsert-rows.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.upsertRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md deleted file mode 100644 index f57ecd3c..00000000 --- a/docs/examples/tokens/create-file-token.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new Tokens(client); - -const result = await tokens.createFileToken({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md deleted file mode 100644 index eaffe5d8..00000000 --- a/docs/examples/tokens/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new Tokens(client); - -const result = await tokens.delete({ - tokenId: '<TOKEN_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md deleted file mode 100644 index b7d1caab..00000000 --- a/docs/examples/tokens/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new Tokens(client); - -const result = await tokens.get({ - tokenId: '<TOKEN_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md deleted file mode 100644 index ff3270ab..00000000 --- a/docs/examples/tokens/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new Tokens(client); - -const result = await tokens.list({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md deleted file mode 100644 index 6e2c08b1..00000000 --- a/docs/examples/tokens/update.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new Tokens(client); - -const result = await tokens.update({ - tokenId: '<TOKEN_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md deleted file mode 100644 index 0b76d58b..00000000 --- a/docs/examples/users/create-argon-2-user.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createArgon2User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md deleted file mode 100644 index 99338d26..00000000 --- a/docs/examples/users/create-bcrypt-user.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createBcryptUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md deleted file mode 100644 index b22d0621..00000000 --- a/docs/examples/users/create-jwt.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createJWT({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>', // optional - duration: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md deleted file mode 100644 index e26104c0..00000000 --- a/docs/examples/users/create-md-5-user.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createMD5User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md deleted file mode 100644 index 1a2cefee..00000000 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md deleted file mode 100644 index a9e06667..00000000 --- a/docs/examples/users/create-ph-pass-user.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createPHPassUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md deleted file mode 100644 index 9cdbc8a1..00000000 --- a/docs/examples/users/create-scrypt-modified-user.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createScryptModifiedUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', - passwordSignerKey: '<PASSWORD_SIGNER_KEY>', - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md deleted file mode 100644 index 073c6f9e..00000000 --- a/docs/examples/users/create-scrypt-user.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createScryptUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordCpu: null, - passwordMemory: null, - passwordParallel: null, - passwordLength: null, - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md deleted file mode 100644 index cae7a143..00000000 --- a/docs/examples/users/create-session.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createSession({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md deleted file mode 100644 index d383ac0e..00000000 --- a/docs/examples/users/create-sha-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users, PasswordHash } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createSHAUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordVersion: PasswordHash.Sha1, // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md deleted file mode 100644 index f5e61468..00000000 --- a/docs/examples/users/create-target.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Users, MessagingProviderType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - providerType: MessagingProviderType.Email, - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md deleted file mode 100644 index da96054a..00000000 --- a/docs/examples/users/create-token.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.createToken({ - userId: '<USER_ID>', - length: 4, // optional - expire: 60 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md deleted file mode 100644 index e5ea5d67..00000000 --- a/docs/examples/users/create.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.create({ - userId: '<USER_ID>', - email: 'email@example.com', // optional - phone: '+12065550100', // optional - password: '', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md deleted file mode 100644 index 4c645536..00000000 --- a/docs/examples/users/delete-identity.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.deleteIdentity({ - identityId: '<IDENTITY_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md deleted file mode 100644 index f9a331a9..00000000 --- a/docs/examples/users/delete-mfa-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users, AuthenticatorType } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.deleteMFAAuthenticator({ - userId: '<USER_ID>', - type: AuthenticatorType.Totp -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md deleted file mode 100644 index e0d1d739..00000000 --- a/docs/examples/users/delete-session.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.deleteSession({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md deleted file mode 100644 index 5d511070..00000000 --- a/docs/examples/users/delete-sessions.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.deleteSessions({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md deleted file mode 100644 index bec3a103..00000000 --- a/docs/examples/users/delete-target.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.deleteTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md deleted file mode 100644 index 1b4cab05..00000000 --- a/docs/examples/users/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.delete({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md deleted file mode 100644 index 044951a1..00000000 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.getMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md deleted file mode 100644 index 75c951c5..00000000 --- a/docs/examples/users/get-prefs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.getPrefs({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md deleted file mode 100644 index dd009647..00000000 --- a/docs/examples/users/get-target.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.getTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md deleted file mode 100644 index a18fc14a..00000000 --- a/docs/examples/users/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.get({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md deleted file mode 100644 index 9c94b793..00000000 --- a/docs/examples/users/list-identities.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listIdentities({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md deleted file mode 100644 index 0797e160..00000000 --- a/docs/examples/users/list-logs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listLogs({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md deleted file mode 100644 index a477e729..00000000 --- a/docs/examples/users/list-memberships.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listMemberships({ - userId: '<USER_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md deleted file mode 100644 index ca68b56b..00000000 --- a/docs/examples/users/list-mfa-factors.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listMFAFactors({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md deleted file mode 100644 index 2d77cb57..00000000 --- a/docs/examples/users/list-sessions.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listSessions({ - userId: '<USER_ID>', - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md deleted file mode 100644 index beb7f0eb..00000000 --- a/docs/examples/users/list-targets.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.listTargets({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md deleted file mode 100644 index 44d7b581..00000000 --- a/docs/examples/users/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md deleted file mode 100644 index 5e72d67c..00000000 --- a/docs/examples/users/update-email-verification.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateEmailVerification({ - userId: '<USER_ID>', - emailVerification: false -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md deleted file mode 100644 index a3d18595..00000000 --- a/docs/examples/users/update-email.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateEmail({ - userId: '<USER_ID>', - email: 'email@example.com' -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md deleted file mode 100644 index 9edd8207..00000000 --- a/docs/examples/users/update-impersonator.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateImpersonator({ - userId: '<USER_ID>', - impersonator: false -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md deleted file mode 100644 index 5b114712..00000000 --- a/docs/examples/users/update-labels.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateLabels({ - userId: '<USER_ID>', - labels: [] -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md deleted file mode 100644 index 7060547e..00000000 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md deleted file mode 100644 index 48b08fc5..00000000 --- a/docs/examples/users/update-mfa.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateMFA({ - userId: '<USER_ID>', - mfa: false -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md deleted file mode 100644 index 3ff68888..00000000 --- a/docs/examples/users/update-name.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateName({ - userId: '<USER_ID>', - name: '<NAME>' -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md deleted file mode 100644 index 018c726d..00000000 --- a/docs/examples/users/update-password.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updatePassword({ - userId: '<USER_ID>', - password: '' -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md deleted file mode 100644 index 3cea6d9a..00000000 --- a/docs/examples/users/update-phone-verification.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updatePhoneVerification({ - userId: '<USER_ID>', - phoneVerification: false -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md deleted file mode 100644 index d58be753..00000000 --- a/docs/examples/users/update-phone.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updatePhone({ - userId: '<USER_ID>', - number: '+12065550100' -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md deleted file mode 100644 index ead7a0b4..00000000 --- a/docs/examples/users/update-prefs.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updatePrefs({ - userId: '<USER_ID>', - prefs: {} -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md deleted file mode 100644 index 2d04e672..00000000 --- a/docs/examples/users/update-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateStatus({ - userId: '<USER_ID>', - status: false -}); - -console.log(result); -``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md deleted file mode 100644 index 350b4b66..00000000 --- a/docs/examples/users/update-target.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new Users(client); - -const result = await users.updateTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', // optional - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md deleted file mode 100644 index 3158cbcf..00000000 --- a/docs/examples/webhooks/create.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.create({ - webhookId: '<WEBHOOK_ID>', - url: '', - name: '<NAME>', - events: [], - enabled: false, // optional - tls: false, // optional - authUsername: '<AUTH_USERNAME>', // optional - authPassword: '<AUTH_PASSWORD>', // optional - secret: '<SECRET>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md deleted file mode 100644 index 35a061c8..00000000 --- a/docs/examples/webhooks/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.delete({ - webhookId: '<WEBHOOK_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md deleted file mode 100644 index 915cffe1..00000000 --- a/docs/examples/webhooks/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.get({ - webhookId: '<WEBHOOK_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md deleted file mode 100644 index a4826aa9..00000000 --- a/docs/examples/webhooks/list.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.list({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md deleted file mode 100644 index 4830a12a..00000000 --- a/docs/examples/webhooks/update-secret.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.updateSecret({ - webhookId: '<WEBHOOK_ID>', - secret: '<SECRET>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md deleted file mode 100644 index 58b6dc3f..00000000 --- a/docs/examples/webhooks/update.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new Webhooks(client); - -const result = await webhooks.update({ - webhookId: '<WEBHOOK_ID>', - name: '<NAME>', - url: '', - events: [], - enabled: false, // optional - tls: false, // optional - authUsername: '<AUTH_USERNAME>', // optional - authPassword: '<AUTH_PASSWORD>' // optional -}); - -console.log(result); -``` diff --git a/package-lock.json b/package-lock.json index a3aa13e6..0adf962c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appwrite", - "version": "26.0.0", + "version": "25.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "appwrite", - "version": "26.0.0", + "version": "25.1.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index b3307c14..42b5b992 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "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": "26.0.0", + "version": "25.1.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/channel.ts b/src/channel.ts index a5d7ee38..d4618a36 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -11,9 +11,10 @@ interface Func { _fn: any } interface Execution { _exec: any } interface Team { _team: any } interface Membership { _mem: any } +interface Presence { _presence: any } interface Resolved { _res: any } -type Actionable = Document | Row | File | Team | Membership; +type Actionable = Document | Row | File | Team | Membership | Presence; function normalize(id: string): string { if (id === undefined || id === null) { @@ -82,7 +83,7 @@ export class Channel<T> { return this.resolve("create"); } - upsert(this: Channel<Document | Row>): Channel<Resolved> { + upsert(this: Channel<Document | Row | Presence>): Channel<Resolved> { return this.resolve("upsert"); } @@ -123,6 +124,10 @@ export class Channel<T> { return new Channel<Membership>(["memberships", normalize(id)]); } + static presence(id: string) { + return new Channel<Presence>(["presences", normalize(id)]); + } + static account(): string { return "account"; } @@ -151,8 +156,12 @@ export class Channel<T> { static memberships(): string { return "memberships"; } + + static presences(): string { + return "presences"; + } } // Export types for backward compatibility with realtime -export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>; +export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership> | Channel<Presence>; export type ResolvedChannel = Channel<Resolved>; diff --git a/src/client.ts b/src/client.ts index 5e9400b2..67ad9829 100644 --- a/src/client.ts +++ b/src/client.ts @@ -344,48 +344,8 @@ class AppwriteException extends Error { /** * Client that handles requests to Appwrite */ -type SDKPlatform = 'client' | 'server'; -type ClientAuth = 'browser' | 'session' | 'devKey' | 'impersonation'; -type ServerAuth = 'apiKey' | 'jwt' | 'cookie'; -type Auth = ClientAuth | ServerAuth; -declare const clientAuthBrand: unique symbol; - -// Forces TypeScript to display the expanded shape on hover instead of an alias name. -type Prettify<T> = { [K in keyof T]: T[K] } & {}; - -type BaseClientParams = { - endpoint: string; - endpointRealtime?: string; - selfSigned?: boolean; - projectId: string; - locale?: string; -}; - -type ImpersonationTarget = - | { userId: string; email?: never; phone?: never } - | { email: string; userId?: never; phone?: never } - | { phone: string; userId?: never; email?: never }; - -type LegacyClientSetter = Extract<keyof ClientRuntime<any>, `set${string}`>; -type ClientAuthBuilder = Extract<keyof ClientRuntime<any>, `with${string}`>; -type ClientInternalMethod = LegacyClientSetter | ClientAuthBuilder; -export type Client<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientInternalMethod>; -type LegacyClient<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientAuthBuilder>; - -type ClientConstructor = { - new <TAuth extends Auth = 'browser'>(): LegacyClient<TAuth>; - from(params: Prettify<BaseClientParams>): Client<'browser'>; - fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'>; - fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'>; - fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'>; - fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'>; - fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'>; - fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'>; -}; - -class ClientRuntime<TAuth extends Auth = 'browser'> { +class Client { static CHUNK_SIZE = 1024 * 1024 * 5; - declare readonly [clientAuthBrand]?: TAuth; /** * Holds configuration such as project. @@ -394,36 +354,27 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { endpoint: string; endpointRealtime: string; project: string; - key: string; jwt: string; locale: string; session: string; - forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; - selfSigned: boolean; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', - key: '', jwt: '', locale: '', session: '', - forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', - selfSigned: false, }; - - private sdkPlatform: SDKPlatform = 'client'; - /** * Custom headers for API requests. */ @@ -431,119 +382,10 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { 'x-sdk-name': 'Web', 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '26.0.0', - 'X-Appwrite-Response-Format': '1.9.4', + 'x-sdk-version': '25.1.0', + 'X-Appwrite-Response-Format': '1.9.5', }; - static from(params: Prettify<BaseClientParams>): Client<'browser'> { - return new ClientRuntime<'browser'>().applyBase<'browser'>(params, 'client'); - } - - static fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'> { - const client = new ClientRuntime<'session'>() - .applyBase<'session'>(params, 'client'); - client.headers['X-Appwrite-Session'] = params.session; - client.config.session = params.session; - return client; - } - - static fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'> { - const client = new ClientRuntime<'apiKey'>() - .applyBase<'apiKey'>(params, 'server'); - client.headers['X-Appwrite-Key'] = params.apiKey; - (client.config as unknown as Record<string, string>).key = params.apiKey; - return client; - } - - static fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'> { - const client = new ClientRuntime<'cookie'>() - .applyBase<'cookie'>(params, 'server'); - client.headers['Cookie'] = params.cookie; - client.config.cookie = params.cookie; - return client; - } - - static fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'> { - const client = new ClientRuntime<'jwt'>() - .applyBase<'jwt'>(params, 'server'); - client.headers['X-Appwrite-JWT'] = params.jwt; - client.config.jwt = params.jwt; - return client; - } - - static fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'> { - const client = new ClientRuntime<'devKey'>() - .applyBase<'devKey'>(params, 'client'); - client.headers['X-Appwrite-Dev-Key'] = params.devKey; - client.config.devkey = params.devKey; - return client; - } - - static fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'> { - const targets = [ - params.userId !== undefined, - params.email !== undefined, - params.phone !== undefined - ].filter(Boolean).length; - - if (targets !== 1) { - throw new AppwriteException('Exactly one impersonation target must be provided'); - } - - const client = new ClientRuntime<'impersonation'>() - .applyBase<'impersonation'>(params, 'client'); - - client.headers['X-Appwrite-Session'] = params.session; - client.config.session = params.session; - - if (params.userId !== undefined) { - client.headers['X-Appwrite-Impersonate-User-Id'] = params.userId; - client.config.impersonateuserid = params.userId; - return client; - } - if (params.email !== undefined) { - client.headers['X-Appwrite-Impersonate-User-Email'] = params.email; - client.config.impersonateuseremail = params.email; - return client; - } - client.headers['X-Appwrite-Impersonate-User-Phone'] = params.phone; - client.config.impersonateuserphone = params.phone; - return client; - } - - withJWT(jwt: string): this { - this.headers['X-Appwrite-JWT'] = jwt; - this.config.jwt = jwt; - return this; - } - - withForwardedUserAgent(forwardedUserAgent: string): this { - this.headers['X-Forwarded-User-Agent'] = forwardedUserAgent; - return this; - } - - private applyBase<T extends Auth>(params: BaseClientParams, sdkPlatform: SDKPlatform): ClientRuntime<T> { - const client = this as unknown as ClientRuntime<T>; - client.sdkPlatform = sdkPlatform; - client.headers['x-sdk-platform'] = sdkPlatform === 'server' ? 'server' : 'client'; - client.setEndpoint(params.endpoint); - client.setProject(params.projectId); - - if (params.locale !== undefined) { - client.setLocale(params.locale); - } - - if (params.endpointRealtime !== undefined) { - client.setEndpointRealtime(params.endpointRealtime); - } - - if (params.selfSigned !== undefined) { - client.setSelfSigned(params.selfSigned); - } - - return client; - } - /** * Get Headers * @@ -565,9 +407,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { * * @returns {this} */ - /** - * @deprecated Use `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, or another static factory instead. - */ setEndpoint(endpoint: string): this { if (!endpoint || typeof endpoint !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -590,9 +429,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { * * @returns {this} */ - /** - * @deprecated Use the `endpointRealtime` field on a static factory params object instead. - */ setEndpointRealtime(endpointRealtime: string): this { if (!endpointRealtime || typeof endpointRealtime !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -607,120 +443,130 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } /** - * Set self-signed + * Set Project * - * @param {boolean} selfSigned + * Your project ID * - * @returns {this} - */ - /** - * @deprecated Use the `selfSigned` field on a static factory params object instead. - */ - setSelfSigned(selfSigned: boolean): this { - this.config.selfSigned = selfSigned; - return this; - } - - /** - * @deprecated Use a static client factory or factory params object instead. + * @param value string + * + * @return {this} */ setProject(value: string): this { this.headers['X-Appwrite-Project'] = value; this.config.project = value; - return this as unknown as this; - } - - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setKey(value: string): ClientRuntime<'apiKey'> { - this.headers['X-Appwrite-Key'] = value; - this.config.key = value; - return this as unknown as ClientRuntime<'apiKey'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set JWT + * + * Your secret JSON Web Token + * + * @param value string + * + * @return {this} */ - setJWT(value: string): ClientRuntime<'jwt'> { + setJWT(value: string): this { this.headers['X-Appwrite-JWT'] = value; this.config.jwt = value; - return this as unknown as ClientRuntime<'jwt'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set Locale + * + * @param value string + * + * @return {this} */ setLocale(value: string): this { this.headers['X-Appwrite-Locale'] = value; this.config.locale = value; - return this as unknown as this; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set Session + * + * The user session to authenticate with + * + * @param value string + * + * @return {this} */ - setSession(value: string): ClientRuntime<'session'> { + setSession(value: string): this { this.headers['X-Appwrite-Session'] = value; this.config.session = value; - return this as unknown as ClientRuntime<'session'>; - } - - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setForwardedUserAgent(value: string): this { - this.headers['X-Forwarded-User-Agent'] = value; - this.config.forwardeduseragent = value; - return this as unknown as this; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set DevKey + * + * Your secret dev API key + * + * @param value string + * + * @return {this} */ - setDevKey(value: string): ClientRuntime<'devKey'> { + setDevKey(value: string): this { this.headers['X-Appwrite-Dev-Key'] = value; this.config.devkey = value; - return this as unknown as ClientRuntime<'devKey'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set Cookie + * + * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + * + * @param value string + * + * @return {this} */ - setCookie(value: string): ClientRuntime<'cookie'> { + setCookie(value: string): this { this.headers['Cookie'] = value; this.config.cookie = value; - return this as unknown as ClientRuntime<'cookie'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set ImpersonateUserId + * + * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} */ - setImpersonateUserId(value: string): ClientRuntime<'impersonation'> { + setImpersonateUserId(value: string): this { this.headers['X-Appwrite-Impersonate-User-Id'] = value; this.config.impersonateuserid = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set ImpersonateUserEmail + * + * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} */ - setImpersonateUserEmail(value: string): ClientRuntime<'impersonation'> { + setImpersonateUserEmail(value: string): this { this.headers['X-Appwrite-Impersonate-User-Email'] = value; this.config.impersonateuseremail = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set ImpersonateUserPhone + * + * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} */ - setImpersonateUserPhone(value: string): ClientRuntime<'impersonation'> { + setImpersonateUserPhone(value: string): this { this.headers['X-Appwrite-Impersonate-User-Phone'] = value; this.config.impersonateuserphone = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - private realtime: Realtime = { socket: undefined, timeout: undefined, @@ -734,13 +580,9 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { lastMessage: undefined, connect: () => { clearTimeout(this.realtime.timeout); - this.realtime.timeout = typeof window !== 'undefined' - ? window.setTimeout(() => { - this.realtime.createSocket(); - }, 50) - : setTimeout(() => { - this.realtime.createSocket(); - }, 50) as unknown as TimeoutHandle; + this.realtime.timeout = window?.setTimeout(() => { + this.realtime.createSocket(); + }, 50); }, getTimeout: () => { switch (true) { @@ -756,20 +598,14 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { }, createHeartbeat: () => { if (this.realtime.heartbeat) { - clearInterval(this.realtime.heartbeat as any); + clearTimeout(this.realtime.heartbeat); } - this.realtime.heartbeat = typeof window !== 'undefined' - ? window.setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000) - : setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000) as unknown as TimeoutHandle; + this.realtime.heartbeat = window?.setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000); }, createSocket: () => { if (this.realtime.subscriptions.size < 1) { @@ -855,14 +691,8 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { let session = this.config.session; if (!session) { - try { - if (typeof window !== 'undefined' && window.localStorage) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.config.project}`]; - } - } catch (error) { - console.error('Failed to parse cookie fallback:', error); - } + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.config.project}`]; } if (session && !messageData?.user) { this.realtime.socket?.send(JSONbig.stringify(<RealtimeRequest>{ @@ -1027,7 +857,7 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { headers = Object.assign({}, this.headers, headers); - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage) { + if (typeof window !== 'undefined' && window.localStorage) { const cookieFallback = window.localStorage.getItem('cookieFallback'); if (cookieFallback) { headers['X-Fallback-Cookies'] = cookieFallback; @@ -1039,12 +869,12 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { headers, }; - if (this.sdkPlatform === 'client' && headers['X-Appwrite-Dev-Key'] === undefined) { + if (headers['X-Appwrite-Dev-Key'] === undefined) { options.credentials = 'include'; } if (method === 'GET') { - for (const [key, value] of Object.entries(ClientRuntime.flatten(params))) { + for (const [key, value] of Object.entries(Client.flatten(params))) { url.searchParams.append(key, value); } } else { @@ -1054,10 +884,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { break; case 'multipart/form-data': - if (typeof FormData === 'undefined' || typeof File === 'undefined') { - throw new AppwriteException('Multipart requests require File and FormData globals'); - } - const formData = new FormData(); for (const [key, value] of Object.entries(params)) { @@ -1082,17 +908,13 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { - if (typeof File === 'undefined' || typeof FormData === 'undefined') { - throw new AppwriteException('Chunked uploads require File and FormData globals'); - } - const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? []; if (!file || !fileParam) { throw new Error('File not found in payload'); } - if (file.size <= ClientRuntime.CHUNK_SIZE) { + if (file.size <= Client.CHUNK_SIZE) { return await this.call(method, url, headers, originalPayload); } @@ -1100,27 +922,26 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { let response = null; while (start < file.size) { - let end = start + ClientRuntime.CHUNK_SIZE; // Prepare end for the next chunk + let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk if (end >= file.size) { end = file.size; // Adjust for the last chunk to include the last byte } - const chunkHeaders = { ...headers }; - chunkHeaders['content-range'] = `bytes ${start}-${end-1}/${file.size}`; + headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`; const chunk = file.slice(start, end); let payload = { ...originalPayload }; payload[fileParam] = new File([chunk], file.name); - response = await this.call(method, url, chunkHeaders, payload); + response = await this.call(method, url, headers, payload); if (onProgress && typeof onProgress === 'function') { onProgress({ $id: response.$id, progress: Math.round((end / file.size) * 100), sizeUploaded: end, - chunksTotal: Math.ceil(file.size / ClientRuntime.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / ClientRuntime.CHUNK_SIZE) + chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE), + chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) }); } @@ -1146,9 +967,9 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { const response = await fetch(uri, options); // type opaque: No-CORS, different-origin response (CORS-issue) - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && response.type === 'opaque') { + if (response.type === 'opaque') { throw new AppwriteException( - `Invalid Origin. Register your new client (${typeof window !== 'undefined' ? window.location.host : 'unknown'}) as a new Web platform on your project console dashboard`, + `Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, 403, "forbidden", "" @@ -1182,7 +1003,7 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { const cookieFallback = response.headers.get('X-Fallback-Cookies'); - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage && cookieFallback) { + if (typeof window !== 'undefined' && window.localStorage && cookieFallback) { window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); window.localStorage.setItem('cookieFallback', cookieFallback); } @@ -1200,7 +1021,7 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { for (const [key, value] of Object.entries(data)) { let finalKey = prefix ? prefix + '[' + key +']' : key; if (Array.isArray(value)) { - output = { ...output, ...ClientRuntime.flatten(value, finalKey) }; + output = { ...output, ...Client.flatten(value, finalKey) }; } else { output[finalKey] = value; } @@ -1210,9 +1031,8 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } } -const Client = ClientRuntime as unknown as ClientConstructor; - export { Client, AppwriteException }; -export type { Models, SDKPlatform, ClientAuth, ServerAuth, Payload, RealtimeResponseEvent, UploadProgress }; export { Query } from './query'; +export type { Models, Payload, UploadProgress }; +export type { RealtimeResponseEvent }; export type { QueryTypes, QueryTypesList } from './query'; diff --git a/src/enums/adapter.ts b/src/enums/adapter.ts deleted file mode 100644 index a3b1ae0c..00000000 --- a/src/enums/adapter.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum Adapter { - Static = 'static', - Ssr = 'ssr', -} \ No newline at end of file diff --git a/src/enums/attribute-status.ts b/src/enums/attribute-status.ts deleted file mode 100644 index ade1d36a..00000000 --- a/src/enums/attribute-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum AttributeStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/auth-method.ts b/src/enums/auth-method.ts deleted file mode 100644 index d5800ad9..00000000 --- a/src/enums/auth-method.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum AuthMethod { - Emailpassword = 'email-password', - Magicurl = 'magic-url', - Emailotp = 'email-otp', - Anonymous = 'anonymous', - Invites = 'invites', - Jwt = 'jwt', - Phone = 'phone', -} \ No newline at end of file diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts deleted file mode 100644 index bd0582ce..00000000 --- a/src/enums/backup-services.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum BackupServices { - Databases = 'databases', - Tablesdb = 'tablesdb', - Documentsdb = 'documentsdb', - Vectorsdb = 'vectorsdb', - Functions = 'functions', - Storage = 'storage', -} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts deleted file mode 100644 index dddeeb2b..00000000 --- a/src/enums/build-runtime.ts +++ /dev/null @@ -1,94 +0,0 @@ -export enum BuildRuntime { - Node145 = 'node-14.5', - Node160 = 'node-16.0', - Node180 = 'node-18.0', - Node190 = 'node-19.0', - Node200 = 'node-20.0', - Node210 = 'node-21.0', - Node22 = 'node-22', - Node23 = 'node-23', - Node24 = 'node-24', - Node25 = 'node-25', - Php80 = 'php-8.0', - Php81 = 'php-8.1', - Php82 = 'php-8.2', - Php83 = 'php-8.3', - Php84 = 'php-8.4', - Ruby30 = 'ruby-3.0', - Ruby31 = 'ruby-3.1', - Ruby32 = 'ruby-3.2', - Ruby33 = 'ruby-3.3', - Ruby34 = 'ruby-3.4', - Ruby40 = 'ruby-4.0', - Python38 = 'python-3.8', - Python39 = 'python-3.9', - Python310 = 'python-3.10', - Python311 = 'python-3.11', - Python312 = 'python-3.12', - Python313 = 'python-3.13', - Python314 = 'python-3.14', - Pythonml311 = 'python-ml-3.11', - Pythonml312 = 'python-ml-3.12', - Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', - Deno140 = 'deno-1.40', - Deno146 = 'deno-1.46', - Deno20 = 'deno-2.0', - Deno25 = 'deno-2.5', - Deno26 = 'deno-2.6', - Dart215 = 'dart-2.15', - Dart216 = 'dart-2.16', - Dart217 = 'dart-2.17', - Dart218 = 'dart-2.18', - Dart219 = 'dart-2.19', - Dart30 = 'dart-3.0', - Dart31 = 'dart-3.1', - Dart33 = 'dart-3.3', - Dart35 = 'dart-3.5', - Dart38 = 'dart-3.8', - Dart39 = 'dart-3.9', - Dart310 = 'dart-3.10', - Dart311 = 'dart-3.11', - Dotnet60 = 'dotnet-6.0', - Dotnet70 = 'dotnet-7.0', - Dotnet80 = 'dotnet-8.0', - Dotnet10 = 'dotnet-10', - Java80 = 'java-8.0', - Java110 = 'java-11.0', - Java170 = 'java-17.0', - Java180 = 'java-18.0', - Java210 = 'java-21.0', - Java22 = 'java-22', - Java25 = 'java-25', - Swift55 = 'swift-5.5', - Swift58 = 'swift-5.8', - Swift59 = 'swift-5.9', - Swift510 = 'swift-5.10', - Swift62 = 'swift-6.2', - Kotlin16 = 'kotlin-1.6', - Kotlin18 = 'kotlin-1.8', - Kotlin19 = 'kotlin-1.9', - Kotlin20 = 'kotlin-2.0', - Kotlin23 = 'kotlin-2.3', - Cpp17 = 'cpp-17', - Cpp20 = 'cpp-20', - Bun10 = 'bun-1.0', - Bun11 = 'bun-1.1', - Bun12 = 'bun-1.2', - Bun13 = 'bun-1.3', - Go123 = 'go-1.23', - Go124 = 'go-1.24', - Go125 = 'go-1.25', - Go126 = 'go-1.26', - Rust183 = 'rust-1.83', - Static1 = 'static-1', - Flutter324 = 'flutter-3.24', - Flutter327 = 'flutter-3.27', - Flutter329 = 'flutter-3.29', - Flutter332 = 'flutter-3.32', - Flutter335 = 'flutter-3.35', - Flutter338 = 'flutter-3.38', - Flutter341 = 'flutter-3.41', -} \ No newline at end of file diff --git a/src/enums/column-status.ts b/src/enums/column-status.ts deleted file mode 100644 index f53e8a66..00000000 --- a/src/enums/column-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum ColumnStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/compression.ts b/src/enums/compression.ts deleted file mode 100644 index 1bec0e78..00000000 --- a/src/enums/compression.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum Compression { - None = 'none', - Gzip = 'gzip', - Zstd = 'zstd', -} \ No newline at end of file diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts deleted file mode 100644 index 8ccd9699..00000000 --- a/src/enums/database-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum DatabaseType { - Legacy = 'legacy', - Tablesdb = 'tablesdb', - Documentsdb = 'documentsdb', - Vectorsdb = 'vectorsdb', -} \ No newline at end of file diff --git a/src/enums/databases-index-type.ts b/src/enums/databases-index-type.ts deleted file mode 100644 index 85ccf867..00000000 --- a/src/enums/databases-index-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum DatabasesIndexType { - Key = 'key', - Fulltext = 'fulltext', - Unique = 'unique', - Spatial = 'spatial', -} \ No newline at end of file diff --git a/src/enums/deployment-download-type.ts b/src/enums/deployment-download-type.ts deleted file mode 100644 index 538709bc..00000000 --- a/src/enums/deployment-download-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum DeploymentDownloadType { - Source = 'source', - Output = 'output', -} \ No newline at end of file diff --git a/src/enums/deployment-status.ts b/src/enums/deployment-status.ts deleted file mode 100644 index 7e8f4a1b..00000000 --- a/src/enums/deployment-status.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum DeploymentStatus { - Waiting = 'waiting', - Processing = 'processing', - Building = 'building', - Ready = 'ready', - Canceled = 'canceled', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/email-template-locale.ts b/src/enums/email-template-locale.ts deleted file mode 100644 index 82656b89..00000000 --- a/src/enums/email-template-locale.ts +++ /dev/null @@ -1,133 +0,0 @@ -export enum EmailTemplateLocale { - Af = 'af', - Arae = 'ar-ae', - Arbh = 'ar-bh', - Ardz = 'ar-dz', - Areg = 'ar-eg', - Ariq = 'ar-iq', - Arjo = 'ar-jo', - Arkw = 'ar-kw', - Arlb = 'ar-lb', - Arly = 'ar-ly', - Arma = 'ar-ma', - Arom = 'ar-om', - Arqa = 'ar-qa', - Arsa = 'ar-sa', - Arsy = 'ar-sy', - Artn = 'ar-tn', - Arye = 'ar-ye', - As = 'as', - Az = 'az', - Be = 'be', - Bg = 'bg', - Bh = 'bh', - Bn = 'bn', - Bs = 'bs', - Ca = 'ca', - Cs = 'cs', - Cy = 'cy', - Da = 'da', - De = 'de', - Deat = 'de-at', - Dech = 'de-ch', - Deli = 'de-li', - Delu = 'de-lu', - El = 'el', - En = 'en', - Enau = 'en-au', - Enbz = 'en-bz', - Enca = 'en-ca', - Engb = 'en-gb', - Enie = 'en-ie', - Enjm = 'en-jm', - Ennz = 'en-nz', - Entt = 'en-tt', - Enus = 'en-us', - Enza = 'en-za', - Eo = 'eo', - Es = 'es', - Esar = 'es-ar', - Esbo = 'es-bo', - Escl = 'es-cl', - Esco = 'es-co', - Escr = 'es-cr', - Esdo = 'es-do', - Esec = 'es-ec', - Esgt = 'es-gt', - Eshn = 'es-hn', - Esmx = 'es-mx', - Esni = 'es-ni', - Espa = 'es-pa', - Espe = 'es-pe', - Espr = 'es-pr', - Espy = 'es-py', - Essv = 'es-sv', - Esuy = 'es-uy', - Esve = 'es-ve', - Et = 'et', - Eu = 'eu', - Fa = 'fa', - Fi = 'fi', - Fo = 'fo', - Fr = 'fr', - Frbe = 'fr-be', - Frca = 'fr-ca', - Frch = 'fr-ch', - Frlu = 'fr-lu', - Ga = 'ga', - Gd = 'gd', - He = 'he', - Hi = 'hi', - Hr = 'hr', - Hu = 'hu', - Id = 'id', - Is = 'is', - It = 'it', - Itch = 'it-ch', - Ja = 'ja', - Ji = 'ji', - Ko = 'ko', - Ku = 'ku', - Lt = 'lt', - Lv = 'lv', - Mk = 'mk', - Ml = 'ml', - Ms = 'ms', - Mt = 'mt', - Nb = 'nb', - Ne = 'ne', - Nl = 'nl', - Nlbe = 'nl-be', - Nn = 'nn', - No = 'no', - Pa = 'pa', - Pl = 'pl', - Pt = 'pt', - Ptbr = 'pt-br', - Rm = 'rm', - Ro = 'ro', - Romd = 'ro-md', - Ru = 'ru', - Rumd = 'ru-md', - Sb = 'sb', - Sk = 'sk', - Sl = 'sl', - Sq = 'sq', - Sr = 'sr', - Sv = 'sv', - Svfi = 'sv-fi', - Th = 'th', - Tn = 'tn', - Tr = 'tr', - Ts = 'ts', - Ua = 'ua', - Ur = 'ur', - Ve = 've', - Vi = 'vi', - Xh = 'xh', - Zhcn = 'zh-cn', - Zhhk = 'zh-hk', - Zhsg = 'zh-sg', - Zhtw = 'zh-tw', - Zu = 'zu', -} \ No newline at end of file diff --git a/src/enums/email-template-type.ts b/src/enums/email-template-type.ts deleted file mode 100644 index 2a561bf0..00000000 --- a/src/enums/email-template-type.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum EmailTemplateType { - Verification = 'verification', - MagicSession = 'magicSession', - Recovery = 'recovery', - Invitation = 'invitation', - MfaChallenge = 'mfaChallenge', - SessionAlert = 'sessionAlert', - OtpSession = 'otpSession', -} \ No newline at end of file diff --git a/src/enums/framework.ts b/src/enums/framework.ts deleted file mode 100644 index 7093da33..00000000 --- a/src/enums/framework.ts +++ /dev/null @@ -1,17 +0,0 @@ -export enum Framework { - Analog = 'analog', - Angular = 'angular', - Nextjs = 'nextjs', - React = 'react', - Nuxt = 'nuxt', - Vue = 'vue', - Sveltekit = 'sveltekit', - Astro = 'astro', - Tanstackstart = 'tanstack-start', - Remix = 'remix', - Lynx = 'lynx', - Flutter = 'flutter', - Reactnative = 'react-native', - Vite = 'vite', - Other = 'other', -} \ No newline at end of file diff --git a/src/enums/health-antivirus-status.ts b/src/enums/health-antivirus-status.ts deleted file mode 100644 index d4da4c4f..00000000 --- a/src/enums/health-antivirus-status.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum HealthAntivirusStatus { - Disabled = 'disabled', - Offline = 'offline', - Online = 'online', -} \ No newline at end of file diff --git a/src/enums/health-check-status.ts b/src/enums/health-check-status.ts deleted file mode 100644 index 9dbc6810..00000000 --- a/src/enums/health-check-status.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum HealthCheckStatus { - Pass = 'pass', - Fail = 'fail', -} \ No newline at end of file diff --git a/src/enums/index-status.ts b/src/enums/index-status.ts deleted file mode 100644 index 6ce90ac8..00000000 --- a/src/enums/index-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum IndexStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/message-priority.ts b/src/enums/message-priority.ts deleted file mode 100644 index f3113a85..00000000 --- a/src/enums/message-priority.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessagePriority { - Normal = 'normal', - High = 'high', -} \ No newline at end of file diff --git a/src/enums/message-status.ts b/src/enums/message-status.ts deleted file mode 100644 index 08bd483b..00000000 --- a/src/enums/message-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum MessageStatus { - Draft = 'draft', - Processing = 'processing', - Scheduled = 'scheduled', - Sent = 'sent', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/messaging-provider-type.ts b/src/enums/messaging-provider-type.ts deleted file mode 100644 index 18c9929b..00000000 --- a/src/enums/messaging-provider-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum MessagingProviderType { - Email = 'email', - Sms = 'sms', - Push = 'push', -} \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts deleted file mode 100644 index 8cd297bc..00000000 --- a/src/enums/name.ts +++ /dev/null @@ -1,15 +0,0 @@ -export enum Name { - V1database = 'v1-database', - V1deletes = 'v1-deletes', - V1audits = 'v1-audits', - V1mails = 'v1-mails', - V1functions = 'v1-functions', - V1statsresources = 'v1-stats-resources', - V1statsusage = 'v1-stats-usage', - V1webhooks = 'v1-webhooks', - V1certificates = 'v1-certificates', - V1builds = 'v1-builds', - V1screenshots = 'v1-screenshots', - V1messaging = 'v1-messaging', - V1migrations = 'v1-migrations', -} \ No newline at end of file diff --git a/src/enums/o-auth-2-google-prompt.ts b/src/enums/o-auth-2-google-prompt.ts deleted file mode 100644 index f8e98e12..00000000 --- a/src/enums/o-auth-2-google-prompt.ts +++ /dev/null @@ -1,5 +0,0 @@ -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 06189633..cc9e340b 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/order-by.ts b/src/enums/order-by.ts deleted file mode 100644 index 62dffb98..00000000 --- a/src/enums/order-by.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum OrderBy { - Asc = 'asc', - Desc = 'desc', -} \ No newline at end of file diff --git a/src/enums/password-hash.ts b/src/enums/password-hash.ts deleted file mode 100644 index 76834af4..00000000 --- a/src/enums/password-hash.ts +++ /dev/null @@ -1,13 +0,0 @@ -export enum PasswordHash { - Sha1 = 'sha1', - Sha224 = 'sha224', - Sha256 = 'sha256', - Sha384 = 'sha384', - Sha512224 = 'sha512/224', - Sha512256 = 'sha512/256', - Sha512 = 'sha512', - Sha3224 = 'sha3-224', - Sha3256 = 'sha3-256', - Sha3384 = 'sha3-384', - Sha3512 = 'sha3-512', -} \ No newline at end of file diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts deleted file mode 100644 index bde1d30f..00000000 --- a/src/enums/platform-type.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum PlatformType { - Windows = 'windows', - Apple = 'apple', - Android = 'android', - Linux = 'linux', - Web = 'web', -} \ No newline at end of file diff --git a/src/enums/project-policy.ts b/src/enums/project-policy.ts deleted file mode 100644 index d52bf99a..00000000 --- a/src/enums/project-policy.ts +++ /dev/null @@ -1,11 +0,0 @@ -export enum ProjectPolicy { - Passworddictionary = 'password-dictionary', - Passwordhistory = 'password-history', - Passwordpersonaldata = 'password-personal-data', - Sessionalert = 'session-alert', - Sessionduration = 'session-duration', - Sessioninvalidation = 'session-invalidation', - Sessionlimit = 'session-limit', - Userlimit = 'user-limit', - Membershipprivacy = 'membership-privacy', -} \ No newline at end of file diff --git a/src/enums/prompt.ts b/src/enums/prompt.ts deleted file mode 100644 index 9bb101fa..00000000 --- a/src/enums/prompt.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum Prompt { - None = 'none', - Consent = 'consent', - SelectAccount = 'select_account', -} \ No newline at end of file diff --git a/src/enums/protocol-id.ts b/src/enums/protocol-id.ts deleted file mode 100644 index 94d9095f..00000000 --- a/src/enums/protocol-id.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ProtocolId { - Rest = 'rest', - Graphql = 'graphql', - Websocket = 'websocket', -} \ No newline at end of file diff --git a/src/enums/proxy-resource-type.ts b/src/enums/proxy-resource-type.ts deleted file mode 100644 index e04c8046..00000000 --- a/src/enums/proxy-resource-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ProxyResourceType { - Site = 'site', - Function = 'function', -} \ No newline at end of file diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts deleted file mode 100644 index 89236c74..00000000 --- a/src/enums/proxy-rule-deployment-resource-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ProxyRuleDeploymentResourceType { - Function = 'function', - Site = 'site', -} \ No newline at end of file diff --git a/src/enums/proxy-rule-status.ts b/src/enums/proxy-rule-status.ts deleted file mode 100644 index 67b8e4cb..00000000 --- a/src/enums/proxy-rule-status.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ProxyRuleStatus { - Unverified = 'unverified', - Verifying = 'verifying', - Verified = 'verified', -} \ No newline at end of file diff --git a/src/enums/relation-mutate.ts b/src/enums/relation-mutate.ts deleted file mode 100644 index 722a7572..00000000 --- a/src/enums/relation-mutate.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum RelationMutate { - Cascade = 'cascade', - Restrict = 'restrict', - SetNull = 'setNull', -} \ No newline at end of file diff --git a/src/enums/relationship-type.ts b/src/enums/relationship-type.ts deleted file mode 100644 index 532015af..00000000 --- a/src/enums/relationship-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum RelationshipType { - OneToOne = 'oneToOne', - ManyToOne = 'manyToOne', - ManyToMany = 'manyToMany', - OneToMany = 'oneToMany', -} \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts deleted file mode 100644 index a2b22ef0..00000000 --- a/src/enums/runtime.ts +++ /dev/null @@ -1,94 +0,0 @@ -export enum Runtime { - Node145 = 'node-14.5', - Node160 = 'node-16.0', - Node180 = 'node-18.0', - Node190 = 'node-19.0', - Node200 = 'node-20.0', - Node210 = 'node-21.0', - Node22 = 'node-22', - Node23 = 'node-23', - Node24 = 'node-24', - Node25 = 'node-25', - Php80 = 'php-8.0', - Php81 = 'php-8.1', - Php82 = 'php-8.2', - Php83 = 'php-8.3', - Php84 = 'php-8.4', - Ruby30 = 'ruby-3.0', - Ruby31 = 'ruby-3.1', - Ruby32 = 'ruby-3.2', - Ruby33 = 'ruby-3.3', - Ruby34 = 'ruby-3.4', - Ruby40 = 'ruby-4.0', - Python38 = 'python-3.8', - Python39 = 'python-3.9', - Python310 = 'python-3.10', - Python311 = 'python-3.11', - Python312 = 'python-3.12', - Python313 = 'python-3.13', - Python314 = 'python-3.14', - Pythonml311 = 'python-ml-3.11', - Pythonml312 = 'python-ml-3.12', - Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', - Deno140 = 'deno-1.40', - Deno146 = 'deno-1.46', - Deno20 = 'deno-2.0', - Deno25 = 'deno-2.5', - Deno26 = 'deno-2.6', - Dart215 = 'dart-2.15', - Dart216 = 'dart-2.16', - Dart217 = 'dart-2.17', - Dart218 = 'dart-2.18', - Dart219 = 'dart-2.19', - Dart30 = 'dart-3.0', - Dart31 = 'dart-3.1', - Dart33 = 'dart-3.3', - Dart35 = 'dart-3.5', - Dart38 = 'dart-3.8', - Dart39 = 'dart-3.9', - Dart310 = 'dart-3.10', - Dart311 = 'dart-3.11', - Dotnet60 = 'dotnet-6.0', - Dotnet70 = 'dotnet-7.0', - Dotnet80 = 'dotnet-8.0', - Dotnet10 = 'dotnet-10', - Java80 = 'java-8.0', - Java110 = 'java-11.0', - Java170 = 'java-17.0', - Java180 = 'java-18.0', - Java210 = 'java-21.0', - Java22 = 'java-22', - Java25 = 'java-25', - Swift55 = 'swift-5.5', - Swift58 = 'swift-5.8', - Swift59 = 'swift-5.9', - Swift510 = 'swift-5.10', - Swift62 = 'swift-6.2', - Kotlin16 = 'kotlin-1.6', - Kotlin18 = 'kotlin-1.8', - Kotlin19 = 'kotlin-1.9', - Kotlin20 = 'kotlin-2.0', - Kotlin23 = 'kotlin-2.3', - Cpp17 = 'cpp-17', - Cpp20 = 'cpp-20', - Bun10 = 'bun-1.0', - Bun11 = 'bun-1.1', - Bun12 = 'bun-1.2', - Bun13 = 'bun-1.3', - Go123 = 'go-1.23', - Go124 = 'go-1.24', - Go125 = 'go-1.25', - Go126 = 'go-1.26', - Rust183 = 'rust-1.83', - Static1 = 'static-1', - Flutter324 = 'flutter-3.24', - Flutter327 = 'flutter-3.27', - Flutter329 = 'flutter-3.29', - Flutter332 = 'flutter-3.32', - Flutter335 = 'flutter-3.35', - Flutter338 = 'flutter-3.38', - Flutter341 = 'flutter-3.41', -} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts deleted file mode 100644 index 5c812100..00000000 --- a/src/enums/scopes.ts +++ /dev/null @@ -1,89 +0,0 @@ -export enum Scopes { - 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', - 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', -} \ No newline at end of file diff --git a/src/enums/secure.ts b/src/enums/secure.ts deleted file mode 100644 index 0ab54cf8..00000000 --- a/src/enums/secure.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum Secure { - Tls = 'tls', - Ssl = 'ssl', -} \ No newline at end of file diff --git a/src/enums/service-id.ts b/src/enums/service-id.ts deleted file mode 100644 index 29281124..00000000 --- a/src/enums/service-id.ts +++ /dev/null @@ -1,19 +0,0 @@ -export enum ServiceId { - Account = 'account', - Avatars = 'avatars', - Databases = 'databases', - Tablesdb = 'tablesdb', - Locale = 'locale', - Health = 'health', - Project = 'project', - Storage = 'storage', - Teams = 'teams', - Users = 'users', - Vcs = 'vcs', - Sites = 'sites', - Functions = 'functions', - Proxy = 'proxy', - Graphql = 'graphql', - Migrations = 'migrations', - Messaging = 'messaging', -} \ No newline at end of file diff --git a/src/enums/smtp-encryption.ts b/src/enums/smtp-encryption.ts deleted file mode 100644 index 876177b6..00000000 --- a/src/enums/smtp-encryption.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum SmtpEncryption { - None = 'none', - Ssl = 'ssl', - Tls = 'tls', -} \ No newline at end of file diff --git a/src/enums/status-code.ts b/src/enums/status-code.ts deleted file mode 100644 index 1f3adf8b..00000000 --- a/src/enums/status-code.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum StatusCode { - MovedPermanently301 = '301', - Found302 = '302', - TemporaryRedirect307 = '307', - PermanentRedirect308 = '308', -} \ No newline at end of file diff --git a/src/enums/tables-db-index-type.ts b/src/enums/tables-db-index-type.ts deleted file mode 100644 index a199cd9c..00000000 --- a/src/enums/tables-db-index-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TablesDBIndexType { - Key = 'key', - Fulltext = 'fulltext', - Unique = 'unique', - Spatial = 'spatial', -} \ No newline at end of file diff --git a/src/enums/template-reference-type.ts b/src/enums/template-reference-type.ts deleted file mode 100644 index bd72cfb5..00000000 --- a/src/enums/template-reference-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TemplateReferenceType { - Commit = 'commit', - Branch = 'branch', - Tag = 'tag', -} \ No newline at end of file diff --git a/src/enums/vcs-reference-type.ts b/src/enums/vcs-reference-type.ts deleted file mode 100644 index cb5270f5..00000000 --- a/src/enums/vcs-reference-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum VCSReferenceType { - Branch = 'branch', - Commit = 'commit', - Tag = 'tag', -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c6c16172..49067db4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,26 +7,19 @@ */ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; -export { Activities } from './services/activities'; export { Avatars } from './services/avatars'; -export { Backups } from './services/backups'; export { Databases } from './services/databases'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; -export { Health } from './services/health'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; -export { Project } from './services/project'; -export { Proxy } from './services/proxy'; -export { Sites } from './services/sites'; +export { Presences } from './services/presences'; +export { Advisor } from './services/advisor'; export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; export { Teams } from './services/teams'; -export { Tokens } from './services/tokens'; -export { Users } from './services/users'; -export { Webhooks } from './services/webhooks'; export { Realtime } from './services/realtime'; -export type { Models, Payload, RealtimeResponseEvent, UploadProgress, SDKPlatform, ClientAuth, ServerAuth } from './client'; +export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; export type { RealtimeSubscription } from './services/realtime'; export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; @@ -44,49 +37,7 @@ export { Theme } from './enums/theme'; export { Timezone } from './enums/timezone'; export { BrowserPermission } from './enums/browser-permission'; export { ImageFormat } from './enums/image-format'; -export { BackupServices } from './enums/backup-services'; -export { RelationshipType } from './enums/relationship-type'; -export { RelationMutate } from './enums/relation-mutate'; -export { DatabasesIndexType } from './enums/databases-index-type'; -export { OrderBy } from './enums/order-by'; -export { Runtime } from './enums/runtime'; -export { Scopes } from './enums/scopes'; -export { TemplateReferenceType } from './enums/template-reference-type'; -export { VCSReferenceType } from './enums/vcs-reference-type'; -export { DeploymentDownloadType } from './enums/deployment-download-type'; export { ExecutionMethod } from './enums/execution-method'; -export { Name } from './enums/name'; -export { MessagePriority } from './enums/message-priority'; -export { SmtpEncryption } from './enums/smtp-encryption'; -export { AuthMethod } from './enums/auth-method'; -export { Prompt } from './enums/prompt'; -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 { StatusCode } from './enums/status-code'; -export { ProxyResourceType } from './enums/proxy-resource-type'; -export { Framework } from './enums/framework'; -export { BuildRuntime } from './enums/build-runtime'; -export { Adapter } from './enums/adapter'; -export { Compression } from './enums/compression'; export { ImageGravity } from './enums/image-gravity'; -export { TablesDBIndexType } from './enums/tables-db-index-type'; -export { PasswordHash } from './enums/password-hash'; -export { MessagingProviderType } from './enums/messaging-provider-type'; -export { DatabaseType } from './enums/database-type'; -export { AttributeStatus } from './enums/attribute-status'; -export { ColumnStatus } from './enums/column-status'; -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'; -export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; -export { ProxyRuleStatus } from './enums/proxy-rule-status'; -export { MessageStatus } from './enums/message-status'; diff --git a/src/models.ts b/src/models.ts index 29e17a22..b1ef4d8f 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,17 +1,5 @@ -import { DatabaseType } from "./enums/database-type" -import { AttributeStatus } from "./enums/attribute-status" -import { ColumnStatus } from "./enums/column-status" -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 { 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" -import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-resource-type" -import { ProxyRuleStatus } from "./enums/proxy-rule-status" -import { MessageStatus } from "./enums/message-status" /** * Appwrite Models @@ -49,87 +37,17 @@ export namespace Models { } /** - * Tables List + * Presences List */ - export type TableList = { + export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = { /** - * Total number of tables that matched your query. + * Total number of presences that matched your query. */ total: number; /** - * List of tables. + * List of presences. */ - tables: Table[]; - } - - /** - * Collections List - */ - export type CollectionList = { - /** - * Total number of collections that matched your query. - */ - total: number; - /** - * List of collections. - */ - collections: Collection[]; - } - - /** - * Databases List - */ - export type DatabaseList = { - /** - * Total number of databases that matched your query. - */ - total: number; - /** - * List of databases. - */ - databases: Database[]; - } - - /** - * Indexes List - */ - export type IndexList = { - /** - * Total number of indexes that matched your query. - */ - total: number; - /** - * List of indexes. - */ - indexes: Index[]; - } - - /** - * Column Indexes List - */ - export type ColumnIndexList = { - /** - * Total number of indexes that matched your query. - */ - total: number; - /** - * List of indexes. - */ - indexes: ColumnIndex[]; - } - - /** - * Users List - */ - export type UserList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * Total number of users that matched your query. - */ - total: number; - /** - * List of users. - */ - users: User<Preferences>[]; + presences: Presence[]; } /** @@ -188,34 +106,6 @@ export namespace Models { files: File[]; } - /** - * Buckets List - */ - export type BucketList = { - /** - * Total number of buckets that matched your query. - */ - total: number; - /** - * List of buckets. - */ - buckets: Bucket[]; - } - - /** - * Resource Tokens List - */ - export type ResourceTokenList = { - /** - * Total number of tokens that matched your query. - */ - total: number; - /** - * List of tokens. - */ - tokens: ResourceToken[]; - } - /** * Teams List */ @@ -244,76 +134,6 @@ export namespace Models { memberships: Membership[]; } - /** - * Sites List - */ - export type SiteList = { - /** - * Total number of sites that matched your query. - */ - total: number; - /** - * List of sites. - */ - sites: Site[]; - } - - /** - * Functions List - */ - export type FunctionList = { - /** - * Total number of functions that matched your query. - */ - total: number; - /** - * List of functions. - */ - functions: Function[]; - } - - /** - * Frameworks List - */ - export type FrameworkList = { - /** - * Total number of frameworks that matched your query. - */ - total: number; - /** - * List of frameworks. - */ - frameworks: Framework[]; - } - - /** - * Runtimes List - */ - export type RuntimeList = { - /** - * Total number of runtimes that matched your query. - */ - total: number; - /** - * List of runtimes. - */ - runtimes: Runtime[]; - } - - /** - * Deployments List - */ - export type DeploymentList = { - /** - * Total number of deployments that matched your query. - */ - total: number; - /** - * List of deployments. - */ - deployments: Deployment[]; - } - /** * Executions List */ @@ -328,34 +148,6 @@ export namespace Models { executions: Execution[]; } - /** - * Webhooks List - */ - export type WebhookList = { - /** - * Total number of webhooks that matched your query. - */ - total: number; - /** - * List of webhooks. - */ - webhooks: Webhook[]; - } - - /** - * API Keys List - */ - export type KeyList = { - /** - * Total number of keys that matched your query. - */ - total: number; - /** - * List of keys. - */ - keys: Key[]; - } - /** * Countries List */ @@ -427,5456 +219,969 @@ export namespace Models { } /** - * Variables List + * Locale codes list */ - export type VariableList = { + export type LocaleCodeList = { /** - * Total number of variables that matched your query. + * Total number of localeCodes that matched your query. */ total: number; /** - * List of variables. + * List of localeCodes. */ - variables: Variable[]; + localeCodes: LocaleCode[]; } /** - * Mock Numbers List + * Transaction List */ - export type MockNumberList = { + export type TransactionList = { /** - * Total number of mockNumbers that matched your query. + * Total number of transactions that matched your query. */ total: number; /** - * List of mockNumbers. + * List of transactions. */ - mockNumbers: MockNumber[]; + transactions: Transaction[]; } /** - * Policies List + * Insights List */ - export type PolicyList = { + export type InsightList = { /** - * Total number of policies in the given project. + * Total number of insights that matched your query. */ total: number; /** - * List of policies. + * List of insights. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + insights: Insight[]; } /** - * Email Templates List + * Reports List */ - export type EmailTemplateList = { + export type ReportList = { /** - * Total number of templates that matched your query. + * Total number of reports that matched your query. */ total: number; /** - * List of templates. + * List of reports. */ - templates: EmailTemplate[]; + reports: Report[]; } /** - * Status List + * Row */ - export type HealthStatusList = { - /** - * Total number of statuses that matched your query. - */ - total: number; + export type Row = { /** - * List of statuses. + * Row ID. */ - statuses: HealthStatus[]; - } - - /** - * Rule List - */ - export type ProxyRuleList = { + $id: string; /** - * Total number of rules that matched your query. + * Row sequence ID. */ - total: number; + $sequence: string; /** - * List of rules. + * Table ID. */ - rules: ProxyRule[]; - } - - /** - * Locale codes list - */ - export type LocaleCodeList = { + $tableId: string; /** - * Total number of localeCodes that matched your query. + * Database ID. */ - total: number; + $databaseId: string; /** - * List of localeCodes. + * Row creation date in ISO 8601 format. */ - localeCodes: LocaleCode[]; - } - - /** - * Provider list - */ - export type ProviderList = { + $createdAt: string; /** - * Total number of providers that matched your query. + * Row update date in ISO 8601 format. */ - total: number; + $updatedAt: string; /** - * List of providers. + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - providers: Provider[]; + $permissions: string[]; } - /** - * Message list - */ - export type MessageList = { - /** - * Total number of messages that matched your query. - */ - total: number; - /** - * List of messages. - */ - messages: Message[]; - } + export type DefaultRow = Row & { + [key: string]: any; + [__default]: true; + }; /** - * Topic list + * Document */ - export type TopicList = { - /** - * Total number of topics that matched your query. - */ - total: number; + export type Document = { /** - * List of topics. + * Document ID. */ - topics: Topic[]; - } - - /** - * Subscriber list - */ - export type SubscriberList = { + $id: string; /** - * Total number of subscribers that matched your query. + * Document sequence ID. */ - total: number; + $sequence: string; /** - * List of subscribers. + * Collection ID. */ - subscribers: Subscriber[]; - } - - /** - * Target list - */ - export type TargetList = { + $collectionId: string; /** - * Total number of targets that matched your query. + * Database ID. */ - total: number; + $databaseId: string; /** - * List of targets. + * Document creation date in ISO 8601 format. */ - targets: Target[]; - } - - /** - * Transaction List - */ - export type TransactionList = { + $createdAt: string; /** - * Total number of transactions that matched your query. + * Document update date in ISO 8601 format. */ - total: number; + $updatedAt: string; /** - * List of transactions. + * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - transactions: Transaction[]; + $permissions: string[]; } - /** - * Specifications List - */ - export type SpecificationList = { - /** - * Total number of specifications that matched your query. - */ - total: number; - /** - * List of specifications. - */ - specifications: Specification[]; - } + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; /** - * Database + * Presence */ - export type Database = { + export type Presence = { /** - * Database ID. + * Presence ID. */ $id: string; /** - * Database name. - */ - name: string; - /** - * Database creation date in ISO 8601 format. + * Presence creation date in ISO 8601 format. */ $createdAt: string; /** - * Database update date in ISO 8601 format. + * Presence update date in ISO 8601 format. */ $updatedAt: string; /** - * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. + * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * User ID. */ - enabled: boolean; + userId: string; /** - * Database type. + * Presence status. */ - type: DatabaseType; + status?: string; /** - * Database backup policies. + * Presence source. */ - policies: Index[]; + source: string; /** - * Database backup archives. + * Presence expiry date in ISO 8601 format. */ - archives: Collection[]; + expiresAt?: string; } + export type DefaultPresence = Presence & { + [key: string]: any; + [__default]: true; + }; + /** - * Collection + * Log */ - export type Collection = { + export type Log = { /** - * Collection ID. + * Event name. */ - $id: string; - /** - * Collection creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Collection update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; + event: string; /** - * Database ID. + * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. */ - databaseId: string; + userId: string; /** - * Collection name. + * User email of the actor recorded for this log. During impersonation, this is the original impersonator. */ - name: string; + userEmail: string; /** - * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. + * User name of the actor recorded for this log. During impersonation, this is the original impersonator. */ - enabled: boolean; + userName: string; /** - * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + * API mode when event triggered. */ - documentSecurity: boolean; + mode: string; /** - * Collection attributes. + * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. */ - attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; + userType: string; /** - * Collection indexes. + * IP session in use when the session was created. */ - indexes: Index[]; + ip: string; /** - * Maximum document size in bytes. Returns 0 when no limit applies. + * Log creation date in ISO 8601 format. */ - bytesMax: number; + time: string; /** - * Currently used document size in bytes based on defined attributes. + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). */ - bytesUsed: number; - } - - /** - * Attributes List - */ - export type AttributeList = { + osCode: string; /** - * Total number of attributes in the given collection. + * Operating system name. */ - total: number; + osName: string; /** - * List of attributes. + * Operating system version. */ - attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; - } - - /** - * AttributeString - */ - export type AttributeString = { + osVersion: string; /** - * Attribute Key. + * Client type. */ - key: string; + clientType: string; /** - * Attribute type. + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). */ - type: string; + clientCode: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Client name. */ - status: AttributeStatus; + clientName: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Client version. */ - error: string; + clientVersion: string; /** - * Is attribute required? + * Client engine name. */ - required: boolean; + clientEngine: string; /** - * Is attribute an array? + * Client engine name. */ - array?: boolean; + clientEngineVersion: string; /** - * Attribute creation date in ISO 8601 format. + * Device name. */ - $createdAt: string; + deviceName: string; /** - * Attribute update date in ISO 8601 format. + * Device brand name. */ - $updatedAt: string; + deviceBrand: string; /** - * Attribute size. + * Device model name. */ - size: number; + deviceModel: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Country two-character ISO 3166-1 alpha code. */ - default?: string; + countryCode: string; /** - * Defines whether this attribute is encrypted or not. + * Country name. */ - encrypt?: boolean; + countryName: string; } /** - * AttributeInteger + * User */ - export type AttributeInteger = { - /** - * Attribute Key. - */ - key: string; + export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { /** - * Attribute type. + * User ID. */ - type: string; + $id: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * User creation date in ISO 8601 format. */ - status: AttributeStatus; + $createdAt: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * User update date in ISO 8601 format. */ - error: string; + $updatedAt: string; /** - * Is attribute required? + * User name. */ - required: boolean; + name: string; /** - * Is attribute an array? + * Hashed user password. */ - array?: boolean; + password?: string; /** - * Attribute creation date in ISO 8601 format. + * Password hashing algorithm. */ - $createdAt: string; + hash?: string; /** - * Attribute update date in ISO 8601 format. + * Password hashing algorithm configuration. */ - $updatedAt: string; + hashOptions?: object; /** - * Minimum value to enforce for new documents. + * User registration date in ISO 8601 format. */ - min?: number | bigint; + registration: string; /** - * Maximum value to enforce for new documents. + * User status. Pass `true` for enabled and `false` for disabled. */ - max?: number | bigint; + status: boolean; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Labels for the user. */ - default?: number; - } - - /** - * AttributeBigInt - */ - export type AttributeBigint = { + labels: string[]; /** - * Attribute Key. + * Password update time in ISO 8601 format. */ - key: string; + passwordUpdate: string; /** - * Attribute type. + * User email address. */ - type: string; + email: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * User phone number in E.164 format. */ - status: AttributeStatus; + phone: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Email verification status. */ - error: string; + emailVerification: boolean; /** - * Is attribute required? + * Phone verification status. */ - required: boolean; + phoneVerification: boolean; /** - * Is attribute an array? + * Multi factor authentication status. */ - array?: boolean; + mfa: boolean; /** - * Attribute creation date in ISO 8601 format. + * User preferences as a key-value object */ - $createdAt: string; + prefs: Preferences; /** - * Attribute update date in ISO 8601 format. + * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. */ - $updatedAt: string; + targets: Target[]; /** - * Minimum value to enforce for new documents. + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. */ - min?: number | bigint; + accessedAt: string; /** - * Maximum value to enforce for new documents. + * Whether the user can impersonate other users. */ - max?: number | bigint; + impersonator?: boolean; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. */ - default?: number | bigint; + impersonatorUserId?: string; } /** - * AttributeFloat + * AlgoMD5 */ - export type AttributeFloat = { - /** - * Attribute Key. - */ - key: string; + export type AlgoMd5 = { /** - * Attribute type. + * Algo type. */ type: string; + } + + /** + * AlgoSHA + */ + export type AlgoSha = { /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Algo type. */ - error: string; + type: string; + } + + /** + * AlgoPHPass + */ + export type AlgoPhpass = { /** - * Is attribute required? + * Algo type. */ - required: boolean; + type: string; + } + + /** + * AlgoBcrypt + */ + export type AlgoBcrypt = { /** - * Is attribute an array? + * Algo type. */ - array?: boolean; + type: string; + } + + /** + * AlgoScrypt + */ + export type AlgoScrypt = { /** - * Attribute creation date in ISO 8601 format. + * Algo type. */ - $createdAt: string; + type: string; /** - * Attribute update date in ISO 8601 format. + * CPU complexity of computed hash. */ - $updatedAt: string; + costCpu: number; /** - * Minimum value to enforce for new documents. + * Memory complexity of computed hash. */ - min?: number; + costMemory: number; /** - * Maximum value to enforce for new documents. + * Parallelization of computed hash. */ - max?: number; + costParallel: number; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Length used to compute hash. */ - default?: number; + length: number; } /** - * AttributeBoolean + * AlgoScryptModified */ - export type AttributeBoolean = { - /** - * Attribute Key. - */ - key: string; + export type AlgoScryptModified = { /** - * Attribute type. + * Algo type. */ type: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Salt used to compute hash. */ - status: AttributeStatus; + salt: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Separator used to compute hash. */ - error: string; + saltSeparator: string; /** - * Is attribute required? + * Key used to compute hash. */ - required: boolean; + signerKey: string; + } + + /** + * AlgoArgon2 + */ + export type AlgoArgon2 = { /** - * Is attribute an array? + * Algo type. */ - array?: boolean; + type: string; /** - * Attribute creation date in ISO 8601 format. + * Memory used to compute hash. */ - $createdAt: string; + memoryCost: number; /** - * Attribute update date in ISO 8601 format. + * Amount of time consumed to compute hash */ - $updatedAt: string; + timeCost: number; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Number of threads used to compute hash. */ - default?: boolean; + threads: number; + } + + /** + * Preferences + */ + export type Preferences = { } + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + /** - * AttributeEmail + * Session */ - export type AttributeEmail = { + export type Session = { /** - * Attribute Key. + * Session ID. */ - key: string; + $id: string; /** - * Attribute type. + * Session creation date in ISO 8601 format. */ - type: string; + $createdAt: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Session update date in ISO 8601 format. */ - status: AttributeStatus; + $updatedAt: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * User ID. */ - error: string; + userId: string; /** - * Is attribute required? + * Session expiration date in ISO 8601 format. */ - required: boolean; + expire: string; /** - * Is attribute an array? + * Session Provider. */ - array?: boolean; + provider: string; /** - * Attribute creation date in ISO 8601 format. + * Session Provider User ID. */ - $createdAt: string; + providerUid: string; /** - * Attribute update date in ISO 8601 format. + * Session Provider Access Token. */ - $updatedAt: string; + providerAccessToken: string; /** - * String format. + * The date of when the access token expires in ISO 8601 format. */ - format: string; + providerAccessTokenExpiry: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Session Provider Refresh Token. */ - default?: string; - } - - /** - * AttributeEnum - */ - export type AttributeEnum = { + providerRefreshToken: string; /** - * Attribute Key. + * IP in use when the session was created. */ - key: string; + ip: string; /** - * Attribute type. + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). */ - type: string; + osCode: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Operating system name. */ - status: AttributeStatus; + osName: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Operating system version. */ - error: string; + osVersion: string; /** - * Is attribute required? + * Client type. */ - required: boolean; + clientType: string; /** - * Is attribute an array? + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). */ - array?: boolean; + clientCode: string; /** - * Attribute creation date in ISO 8601 format. + * Client name. */ - $createdAt: string; + clientName: string; /** - * Attribute update date in ISO 8601 format. + * Client version. */ - $updatedAt: string; - /** - * Array of elements in enumerated type. - */ - elements: string[]; - /** - * String format. - */ - format: string; + clientVersion: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Client engine name. */ - default?: string; - } - - /** - * AttributeIP - */ - export type AttributeIp = { + clientEngine: string; /** - * Attribute Key. + * Client engine name. */ - key: string; + clientEngineVersion: string; /** - * Attribute type. + * Device name. */ - type: string; + deviceName: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Device brand name. */ - status: AttributeStatus; + deviceBrand: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Device model name. */ - error: string; + deviceModel: string; /** - * Is attribute required? + * Country two-character ISO 3166-1 alpha code. */ - required: boolean; + countryCode: string; /** - * Is attribute an array? + * Country name. */ - array?: boolean; + countryName: string; /** - * Attribute creation date in ISO 8601 format. + * Returns true if this the current user session. */ - $createdAt: string; + current: boolean; /** - * Attribute update date in ISO 8601 format. + * Returns a list of active session factors. */ - $updatedAt: string; + factors: string[]; /** - * String format. + * Secret used to authenticate the user. Only included if the request was made with an API key */ - format: string; + secret: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. */ - default?: string; + mfaUpdatedAt: string; } /** - * AttributeURL + * Identity */ - export type AttributeUrl = { + export type Identity = { /** - * Attribute Key. + * Identity ID. */ - key: string; + $id: string; /** - * Attribute type. + * Identity creation date in ISO 8601 format. */ - type: string; + $createdAt: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Identity update date in ISO 8601 format. */ - status: AttributeStatus; + $updatedAt: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * User ID. */ - error: string; + userId: string; /** - * Is attribute required? + * Identity Provider. */ - required: boolean; + provider: string; /** - * Is attribute an array? + * ID of the User in the Identity Provider. */ - array?: boolean; + providerUid: string; /** - * Attribute creation date in ISO 8601 format. + * Email of the User in the Identity Provider. */ - $createdAt: string; + providerEmail: string; /** - * Attribute update date in ISO 8601 format. + * Identity Provider Access Token. */ - $updatedAt: string; + providerAccessToken: string; /** - * String format. + * The date of when the access token expires in ISO 8601 format. */ - format: string; + providerAccessTokenExpiry: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Identity Provider Refresh Token. */ - default?: string; + providerRefreshToken: string; } /** - * AttributeDatetime + * Token */ - export type AttributeDatetime = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; + export type Token = { /** - * Is attribute required? + * Token ID. */ - required: boolean; + $id: string; /** - * Is attribute an array? + * Token creation date in ISO 8601 format. */ - array?: boolean; + $createdAt: string; /** - * Attribute creation date in ISO 8601 format. + * User ID. */ - $createdAt: string; + userId: string; /** - * Attribute update date in ISO 8601 format. + * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. */ - $updatedAt: string; + secret: string; /** - * ISO 8601 format. + * Token expiration date in ISO 8601 format. */ - format: string; + expire: string; /** - * Default value for attribute when not provided. Only null is optional + * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. */ - default?: string; + phrase: string; } /** - * AttributeRelationship + * JWT */ - export type AttributeRelationship = { + export type Jwt = { /** - * Attribute Key. + * JWT encoded string. */ - key: string; + jwt: string; + } + + /** + * Locale + */ + export type Locale = { /** - * Attribute type. + * User IP address. */ - type: string; + ip: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format */ - status: AttributeStatus; + countryCode: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Country name. This field support localization. */ - error: string; + country: string; /** - * Is attribute required? + * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. */ - required: boolean; + continentCode: string; /** - * Is attribute an array? + * Continent name. This field support localization. */ - array?: boolean; + continent: string; /** - * Attribute creation date in ISO 8601 format. + * True if country is part of the European Union. */ - $createdAt: string; + eu: boolean; /** - * Attribute update date in ISO 8601 format. + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format */ - $updatedAt: string; + currency: string; + } + + /** + * LocaleCode + */ + export type LocaleCode = { /** - * The ID of the related collection. + * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) */ - relatedCollection: string; + code: string; /** - * The type of the relationship. + * Locale name */ - relationType: string; + name: string; + } + + /** + * File + */ + export type File = { /** - * Is the relationship two-way? + * File ID. */ - twoWay: boolean; + $id: string; /** - * The key of the two-way relationship. + * Bucket ID. */ - twoWayKey: string; + bucketId: string; /** - * How deleting the parent document will propagate to child documents. + * File creation date in ISO 8601 format. */ - onDelete: string; + $createdAt: string; /** - * Whether this is the parent or child side of the relationship + * File update date in ISO 8601 format. */ - side: string; - } - - /** - * AttributePoint - */ - export type AttributePoint = { + $updatedAt: string; /** - * Attribute Key. + * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - key: string; + $permissions: string[]; /** - * Attribute type. + * File name. */ - type: string; + name: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * File MD5 signature. */ - status: AttributeStatus; + signature: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * File mime type. */ - error: string; + mimeType: string; /** - * Is attribute required? + * File original size in bytes. */ - required: boolean; + sizeOriginal: number; /** - * Is attribute an array? + * Total number of chunks available */ - array?: boolean; + chunksTotal: number; /** - * Attribute creation date in ISO 8601 format. + * Total number of chunks uploaded */ - $createdAt: string; + chunksUploaded: number; /** - * Attribute update date in ISO 8601 format. + * Whether file contents are encrypted at rest. */ - $updatedAt: string; + encryption: boolean; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). */ - default?: any[]; + compression: string; } /** - * AttributeLine + * Team */ - export type AttributeLine = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; + export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Team ID. */ - error: string; + $id: string; /** - * Is attribute required? + * Team creation date in ISO 8601 format. */ - required: boolean; + $createdAt: string; /** - * Is attribute an array? + * Team update date in ISO 8601 format. */ - array?: boolean; + $updatedAt: string; /** - * Attribute creation date in ISO 8601 format. + * Team name. */ - $createdAt: string; + name: string; /** - * Attribute update date in ISO 8601 format. + * Total number of team members. */ - $updatedAt: string; + total: number; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Team preferences as a key-value object */ - default?: any[]; + prefs: Preferences; } /** - * AttributePolygon + * Membership */ - export type AttributePolygon = { + export type Membership = { /** - * Attribute Key. + * Membership ID. */ - key: string; + $id: string; /** - * Attribute type. + * Membership creation date in ISO 8601 format. */ - type: string; + $createdAt: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * Membership update date in ISO 8601 format. */ - status: AttributeStatus; + $updatedAt: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * User ID. */ - error: string; + userId: string; /** - * Is attribute required? + * User name. Hide this attribute by toggling membership privacy in the Console. */ - required: boolean; + userName: string; /** - * Is attribute an array? + * User email address. Hide this attribute by toggling membership privacy in the Console. */ - array?: boolean; + userEmail: string; /** - * Attribute creation date in ISO 8601 format. + * User phone number. Hide this attribute by toggling membership privacy in the Console. */ - $createdAt: string; + userPhone: string; /** - * Attribute update date in ISO 8601 format. + * Team ID. */ - $updatedAt: string; + teamId: string; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Team name. */ - default?: any[]; - } - - /** - * AttributeVarchar - */ - export type AttributeVarchar = { + teamName: string; /** - * Attribute Key. + * Date, the user has been invited to join the team in ISO 8601 format. */ - key: string; + invited: string; /** - * Attribute type. + * Date, the user has accepted the invitation to join the team in ISO 8601 format. */ - type: string; + joined: string; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * User confirmation status, true if the user has joined the team or false otherwise. */ - status: AttributeStatus; + confirm: boolean; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. */ - error: string; + mfa: boolean; /** - * Is attribute required? + * User list of roles */ - required: boolean; + roles: string[]; + } + + /** + * Execution + */ + export type Execution = { /** - * Is attribute an array? + * Execution ID. */ - array?: boolean; + $id: string; /** - * Attribute creation date in ISO 8601 format. + * Execution creation date in ISO 8601 format. */ $createdAt: string; /** - * Attribute update date in ISO 8601 format. + * Execution update date in ISO 8601 format. */ $updatedAt: string; /** - * Attribute size. + * Execution roles. */ - size: number; + $permissions: string[]; /** - * Default value for attribute when not provided. Cannot be set when attribute is required. + * Function ID. */ - default?: string; + functionId: string; /** - * Defines whether this attribute is encrypted or not. + * Function's deployment ID used to create the execution. */ - encrypt?: boolean; - } - - /** - * AttributeText - */ - export type AttributeText = { + deploymentId: string; /** - * Attribute Key. + * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. */ - key: string; + trigger: ExecutionTrigger; /** - * Attribute type. + * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. */ - type: string; + status: ExecutionStatus; /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + * HTTP request method type. */ - status: AttributeStatus; + requestMethod: string; /** - * Error message. Displays error generated on failure of creating or deleting an attribute. + * HTTP request path and query. */ - error: string; + requestPath: string; /** - * Is attribute required? + * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. */ - required: boolean; + requestHeaders: Headers[]; /** - * Is attribute an array? + * HTTP response status code. */ - array?: boolean; + responseStatusCode: number; /** - * Attribute creation date in ISO 8601 format. + * HTTP response body. This will return empty unless execution is created as synchronous. */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeMediumtext - */ - export type AttributeMediumtext = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeLongtext - */ - export type AttributeLongtext = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * Table - */ - export type Table = { - /** - * Table ID. - */ - $id: string; - /** - * Table creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Table update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Database ID. - */ - databaseId: string; - /** - * Table name. - */ - name: string; - /** - * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - enabled: boolean; - /** - * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - rowSecurity: boolean; - /** - * Table columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; - /** - * Table indexes. - */ - indexes: ColumnIndex[]; - /** - * Maximum row size in bytes. Returns 0 when no limit applies. - */ - bytesMax: number; - /** - * Currently used row size in bytes based on defined columns. - */ - bytesUsed: number; - } - - /** - * Columns List - */ - export type ColumnList = { - /** - * Total number of columns in the given table. - */ - total: number; - /** - * List of columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; - } - - /** - * ColumnString - */ - export type ColumnString = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Column size. - */ - size: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnInteger - */ - export type ColumnInteger = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number; - } - - /** - * ColumnBigInt - */ - export type ColumnBigint = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number | bigint; - } - - /** - * ColumnFloat - */ - export type ColumnFloat = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number; - /** - * Maximum value to enforce for new documents. - */ - max?: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number; - } - - /** - * ColumnBoolean - */ - export type ColumnBoolean = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: boolean; - } - - /** - * ColumnEmail - */ - export type ColumnEmail = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnEnum - */ - export type ColumnEnum = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Array of elements in enumerated type. - */ - elements: string[]; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnIP - */ - export type ColumnIp = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnURL - */ - export type ColumnUrl = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnDatetime - */ - export type ColumnDatetime = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ISO 8601 format. - */ - format: string; - /** - * Default value for column when not provided. Only null is optional - */ - default?: string; - } - - /** - * ColumnRelationship - */ - export type ColumnRelationship = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The ID of the related table. - */ - relatedTable: string; - /** - * The type of the relationship. - */ - relationType: string; - /** - * Is the relationship two-way? - */ - twoWay: boolean; - /** - * The key of the two-way relationship. - */ - twoWayKey: string; - /** - * How deleting the parent document will propagate to child documents. - */ - onDelete: string; - /** - * Whether this is the parent or child side of the relationship - */ - side: string; - } - - /** - * ColumnPoint - */ - export type ColumnPoint = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnLine - */ - export type ColumnLine = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnPolygon - */ - export type ColumnPolygon = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnVarchar - */ - export type ColumnVarchar = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Column size. - */ - size: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnText - */ - export type ColumnText = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnMediumtext - */ - export type ColumnMediumtext = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnLongtext - */ - export type ColumnLongtext = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * Index - */ - export type Index = { - /** - * Index ID. - */ - $id: string; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Index key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: IndexStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index attributes. - */ - attributes: string[]; - /** - * Index attributes length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - } - - /** - * Index - */ - export type ColumnIndex = { - /** - * Index ID. - */ - $id: string; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Index Key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: string; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index columns. - */ - columns: string[]; - /** - * Index columns length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - } - - /** - * Row - */ - export type Row = { - /** - * Row ID. - */ - $id: string; - /** - * Row sequence ID. - */ - $sequence: string; - /** - * Table ID. - */ - $tableId: string; - /** - * Database ID. - */ - $databaseId: string; - /** - * Row creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Row update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - } - - export type DefaultRow = Row & { - [key: string]: any; - [__default]: true; - }; - - /** - * Document - */ - export type Document = { - /** - * Document ID. - */ - $id: string; - /** - * Document sequence ID. - */ - $sequence: string; - /** - * Collection ID. - */ - $collectionId: string; - /** - * Database ID. - */ - $databaseId: string; - /** - * Document creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Document update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - } - - export type DefaultDocument = Document & { - [key: string]: any; - [__default]: true; - }; - - /** - * Log - */ - export type Log = { - /** - * Event name. - */ - event: string; - /** - * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. - */ - userId: string; - /** - * User email of the actor recorded for this log. During impersonation, this is the original impersonator. - */ - userEmail: string; - /** - * User name of the actor recorded for this log. During impersonation, this is the original impersonator. - */ - userName: string; - /** - * API mode when event triggered. - */ - mode: string; - /** - * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. - */ - userType: string; - /** - * IP session in use when the session was created. - */ - ip: string; - /** - * Log creation date in ISO 8601 format. - */ - time: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * User - */ - export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * User ID. - */ - $id: string; - /** - * User creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User name. - */ - name: string; - /** - * Hashed user password. - */ - password?: string; - /** - * Password hashing algorithm. - */ - hash?: string; - /** - * Password hashing algorithm configuration. - */ - hashOptions?: object; - /** - * User registration date in ISO 8601 format. - */ - registration: string; - /** - * User status. Pass `true` for enabled and `false` for disabled. - */ - status: boolean; - /** - * Labels for the user. - */ - labels: string[]; - /** - * Password update time in ISO 8601 format. - */ - passwordUpdate: string; - /** - * User email address. - */ - email: string; - /** - * User phone number in E.164 format. - */ - phone: string; - /** - * Email verification status. - */ - emailVerification: boolean; - /** - * Phone verification status. - */ - phoneVerification: boolean; - /** - * Multi factor authentication status. - */ - mfa: boolean; - /** - * User preferences as a key-value object - */ - prefs: Preferences; - /** - * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. - */ - targets: Target[]; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * Whether the user can impersonate other users. - */ - impersonator?: boolean; - /** - * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. - */ - impersonatorUserId?: string; - } - - /** - * AlgoMD5 - */ - export type AlgoMd5 = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoSHA - */ - export type AlgoSha = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoPHPass - */ - export type AlgoPhpass = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoBcrypt - */ - export type AlgoBcrypt = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoScrypt - */ - export type AlgoScrypt = { - /** - * Algo type. - */ - type: string; - /** - * CPU complexity of computed hash. - */ - costCpu: number; - /** - * Memory complexity of computed hash. - */ - costMemory: number; - /** - * Parallelization of computed hash. - */ - costParallel: number; - /** - * Length used to compute hash. - */ - length: number; - } - - /** - * AlgoScryptModified - */ - export type AlgoScryptModified = { - /** - * Algo type. - */ - type: string; - /** - * Salt used to compute hash. - */ - salt: string; - /** - * Separator used to compute hash. - */ - saltSeparator: string; - /** - * Key used to compute hash. - */ - signerKey: string; - } - - /** - * AlgoArgon2 - */ - export type AlgoArgon2 = { - /** - * Algo type. - */ - type: string; - /** - * Memory used to compute hash. - */ - memoryCost: number; - /** - * Amount of time consumed to compute hash - */ - timeCost: number; - /** - * Number of threads used to compute hash. - */ - threads: number; - } - - /** - * Preferences - */ - export type Preferences = { - } - - export type DefaultPreferences = Preferences & { - [key: string]: any; - [__default]: true; - }; - - /** - * Session - */ - export type Session = { - /** - * Session ID. - */ - $id: string; - /** - * Session creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Session update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * Session expiration date in ISO 8601 format. - */ - expire: string; - /** - * Session Provider. - */ - provider: string; - /** - * Session Provider User ID. - */ - providerUid: string; - /** - * Session Provider Access Token. - */ - providerAccessToken: string; - /** - * The date of when the access token expires in ISO 8601 format. - */ - providerAccessTokenExpiry: string; - /** - * Session Provider Refresh Token. - */ - providerRefreshToken: string; - /** - * IP in use when the session was created. - */ - ip: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - /** - * Returns true if this the current user session. - */ - current: boolean; - /** - * Returns a list of active session factors. - */ - factors: string[]; - /** - * Secret used to authenticate the user. Only included if the request was made with an API key - */ - secret: string; - /** - * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. - */ - mfaUpdatedAt: string; - } - - /** - * Identity - */ - export type Identity = { - /** - * Identity ID. - */ - $id: string; - /** - * Identity creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Identity update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * Identity Provider. - */ - provider: string; - /** - * ID of the User in the Identity Provider. - */ - providerUid: string; - /** - * Email of the User in the Identity Provider. - */ - providerEmail: string; - /** - * Identity Provider Access Token. - */ - providerAccessToken: string; - /** - * The date of when the access token expires in ISO 8601 format. - */ - providerAccessTokenExpiry: string; - /** - * Identity Provider Refresh Token. - */ - providerRefreshToken: string; - } - - /** - * Token - */ - export type Token = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User ID. - */ - userId: string; - /** - * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - secret: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - /** - * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. - */ - phrase: string; - } - - /** - * JWT - */ - export type Jwt = { - /** - * JWT encoded string. - */ - jwt: string; - } - - /** - * Locale - */ - export type Locale = { - /** - * User IP address. - */ - ip: string; - /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format - */ - countryCode: string; - /** - * Country name. This field support localization. - */ - country: string; - /** - * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. - */ - continentCode: string; - /** - * Continent name. This field support localization. - */ - continent: string; - /** - * True if country is part of the European Union. - */ - eu: boolean; - /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format - */ - currency: string; - } - - /** - * LocaleCode - */ - export type LocaleCode = { - /** - * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - */ - code: string; - /** - * Locale name - */ - name: string; - } - - /** - * File - */ - export type File = { - /** - * File ID. - */ - $id: string; - /** - * Bucket ID. - */ - bucketId: string; - /** - * File creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * File update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * File name. - */ - name: string; - /** - * File MD5 signature. - */ - signature: string; - /** - * File mime type. - */ - mimeType: string; - /** - * File original size in bytes. - */ - sizeOriginal: number; - /** - * Total number of chunks available - */ - chunksTotal: number; - /** - * Total number of chunks uploaded - */ - chunksUploaded: number; - /** - * Whether file contents are encrypted at rest. - */ - encryption: boolean; - /** - * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - */ - compression: string; - } - - /** - * Bucket - */ - export type Bucket = { - /** - * Bucket ID. - */ - $id: string; - /** - * Bucket creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Bucket update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - fileSecurity: boolean; - /** - * Bucket name. - */ - name: string; - /** - * Bucket enabled. - */ - enabled: boolean; - /** - * Maximum file size supported. - */ - maximumFileSize: number; - /** - * Allowed file extensions. - */ - allowedFileExtensions: string[]; - /** - * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - */ - compression: string; - /** - * Bucket is encrypted. - */ - encryption: boolean; - /** - * Virus scanning is enabled. - */ - antivirus: boolean; - /** - * Image transformations are enabled. - */ - transformations: boolean; - /** - * Total size of this bucket in bytes. - */ - totalSize: number; - } - - /** - * ResourceToken - */ - export type ResourceToken = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource type. - */ - resourceType: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - /** - * JWT encoded string. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - } - - /** - * Team - */ - export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * Team ID. - */ - $id: string; - /** - * Team creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Team update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Team name. - */ - name: string; - /** - * Total number of team members. - */ - total: number; - /** - * Team preferences as a key-value object - */ - prefs: Preferences; - } - - /** - * Membership - */ - export type Membership = { - /** - * Membership ID. - */ - $id: string; - /** - * Membership creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Membership update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * User name. Hide this attribute by toggling membership privacy in the Console. - */ - userName: string; - /** - * User email address. Hide this attribute by toggling membership privacy in the Console. - */ - userEmail: string; - /** - * User phone number. Hide this attribute by toggling membership privacy in the Console. - */ - userPhone: string; - /** - * Team ID. - */ - teamId: string; - /** - * Team name. - */ - teamName: string; - /** - * Date, the user has been invited to join the team in ISO 8601 format. - */ - invited: string; - /** - * Date, the user has accepted the invitation to join the team in ISO 8601 format. - */ - joined: string; - /** - * User confirmation status, true if the user has joined the team or false otherwise. - */ - confirm: boolean; - /** - * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. - */ - mfa: boolean; - /** - * User list of roles - */ - roles: string[]; - } - - /** - * Site - */ - export type Site = { - /** - * Site ID. - */ - $id: string; - /** - * Site creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Site update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Site name. - */ - name: string; - /** - * Site enabled. - */ - enabled: boolean; - /** - * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. - */ - live: boolean; - /** - * When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - */ - logging: boolean; - /** - * Site framework. - */ - framework: string; - /** - * How many days to keep the non-active deployments before they will be automatically deleted. - */ - deploymentRetention: number; - /** - * Site's active deployment ID. - */ - deploymentId: string; - /** - * Active deployment creation date in ISO 8601 format. - */ - deploymentCreatedAt: string; - /** - * Screenshot of active deployment with light theme preference file ID. - */ - deploymentScreenshotLight: string; - /** - * Screenshot of active deployment with dark theme preference file ID. - */ - deploymentScreenshotDark: string; - /** - * Site's latest deployment ID. - */ - latestDeploymentId: string; - /** - * Latest deployment creation date in ISO 8601 format. - */ - latestDeploymentCreatedAt: string; - /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - */ - latestDeploymentStatus: string; - /** - * Site variables. - */ - vars: Variable[]; - /** - * Site request timeout in seconds. - */ - timeout: number; - /** - * The install command used to install the site dependencies. - */ - installCommand: string; - /** - * The build command used to build the site. - */ - buildCommand: string; - /** - * Custom command to use when starting site runtime. - */ - startCommand: string; - /** - * The directory where the site build output is located. - */ - outputDirectory: string; - /** - * Site VCS (Version Control System) installation id. - */ - installationId: string; - /** - * VCS (Version Control System) Repository ID - */ - providerRepositoryId: string; - /** - * VCS (Version Control System) branch name - */ - providerBranch: string; - /** - * Path to site in VCS (Version Control System) repository - */ - providerRootDirectory: string; - /** - * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - */ - providerSilentMode: boolean; - /** - * Machine specification for deployment builds. - */ - buildSpecification: string; - /** - * Machine specification for SSR executions. - */ - runtimeSpecification: string; - /** - * Site build runtime. - */ - buildRuntime: string; - /** - * Site framework adapter. - */ - adapter: string; - /** - * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - */ - fallbackFile: string; - } - - /** - * Function - */ - export type Function = { - /** - * Function ID. - */ - $id: string; - /** - * Function creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Function update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Execution permissions. - */ - execute: string[]; - /** - * Function name. - */ - name: string; - /** - * Function enabled. - */ - enabled: boolean; - /** - * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. - */ - live: boolean; - /** - * When disabled, executions will exclude logs and errors, and will be slightly faster. - */ - logging: boolean; - /** - * Function execution and build runtime. - */ - runtime: string; - /** - * How many days to keep the non-active deployments before they will be automatically deleted. - */ - deploymentRetention: number; - /** - * Function's active deployment ID. - */ - deploymentId: string; - /** - * Active deployment creation date in ISO 8601 format. - */ - deploymentCreatedAt: string; - /** - * Function's latest deployment ID. - */ - latestDeploymentId: string; - /** - * Latest deployment creation date in ISO 8601 format. - */ - latestDeploymentCreatedAt: string; - /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - */ - latestDeploymentStatus: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Function variables. - */ - vars: Variable[]; - /** - * Function trigger events. - */ - events: string[]; - /** - * Function execution schedule in CRON format. - */ - schedule: string; - /** - * Function execution timeout in seconds. - */ - timeout: number; - /** - * The entrypoint file used to execute the deployment. - */ - entrypoint: string; - /** - * The build command used to build the deployment. - */ - commands: string; - /** - * Version of Open Runtimes used for the function. - */ - version: string; - /** - * Function VCS (Version Control System) installation id. - */ - installationId: string; - /** - * VCS (Version Control System) Repository ID - */ - providerRepositoryId: string; - /** - * VCS (Version Control System) branch name - */ - providerBranch: string; - /** - * Path to function in VCS (Version Control System) repository - */ - providerRootDirectory: string; - /** - * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - */ - providerSilentMode: boolean; - /** - * Machine specification for deployment builds. - */ - buildSpecification: string; - /** - * Machine specification for executions. - */ - runtimeSpecification: string; - } - - /** - * Runtime - */ - export type Runtime = { - /** - * Runtime ID. - */ - $id: string; - /** - * Parent runtime key. - */ - key: string; - /** - * Runtime Name. - */ - name: string; - /** - * Runtime version. - */ - version: string; - /** - * Base Docker image used to build the runtime. - */ - base: string; - /** - * Image name of Docker Hub. - */ - image: string; - /** - * Name of the logo image. - */ - logo: string; - /** - * List of supported architectures. - */ - supports: string[]; - } - - /** - * Framework - */ - export type Framework = { - /** - * Framework key. - */ - key: string; - /** - * Framework Name. - */ - name: string; - /** - * Default runtime version. - */ - buildRuntime: string; - /** - * List of supported runtime versions. - */ - runtimes: string[]; - /** - * List of supported adapters. - */ - adapters: FrameworkAdapter[]; - } - - /** - * Framework Adapter - */ - export type FrameworkAdapter = { - /** - * Adapter key. - */ - key: string; - /** - * Default command to download dependencies. - */ - installCommand: string; - /** - * Default command to build site into output directory. - */ - buildCommand: string; - /** - * Default output directory of build. - */ - outputDirectory: string; - /** - * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - */ - fallbackFile: string; - } - - /** - * Deployment - */ - export type Deployment = { - /** - * Deployment ID. - */ - $id: string; - /** - * Deployment creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Deployment update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Type of deployment. - */ - type: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource type. - */ - resourceType: string; - /** - * The entrypoint file to use to execute the deployment code. - */ - entrypoint: string; - /** - * The code size in bytes. - */ - sourceSize: number; - /** - * The build output size in bytes. - */ - buildSize: number; - /** - * The total size in bytes (source and build output). - */ - totalSize: number; - /** - * The current build ID. - */ - buildId: string; - /** - * Whether the deployment should be automatically activated. - */ - activate: boolean; - /** - * Screenshot with light theme preference file ID. - */ - screenshotLight: string; - /** - * Screenshot with dark theme preference file ID. - */ - screenshotDark: string; - /** - * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". - */ - status: DeploymentStatus; - /** - * The build logs. - */ - buildLogs: string; - /** - * The current build time in seconds. - */ - buildDuration: number; - /** - * The name of the vcs provider repository - */ - providerRepositoryName: string; - /** - * The name of the vcs provider repository owner - */ - providerRepositoryOwner: string; - /** - * The url of the vcs provider repository - */ - providerRepositoryUrl: string; - /** - * The commit hash of the vcs commit - */ - providerCommitHash: string; - /** - * The url of vcs commit author - */ - providerCommitAuthorUrl: string; - /** - * The name of vcs commit author - */ - providerCommitAuthor: string; - /** - * The commit message - */ - providerCommitMessage: string; - /** - * The url of the vcs commit - */ - providerCommitUrl: string; - /** - * The branch of the vcs repository - */ - providerBranch: string; - /** - * The branch of the vcs repository - */ - providerBranchUrl: string; - } - - /** - * Execution - */ - export type Execution = { - /** - * Execution ID. - */ - $id: string; - /** - * Execution creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Execution update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Execution roles. - */ - $permissions: string[]; - /** - * Function ID. - */ - functionId: string; - /** - * Function's deployment ID used to create the execution. - */ - deploymentId: string; - /** - * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - */ - trigger: ExecutionTrigger; - /** - * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. - */ - status: ExecutionStatus; - /** - * HTTP request method type. - */ - requestMethod: string; - /** - * HTTP request path and query. - */ - requestPath: string; - /** - * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - */ - requestHeaders: Headers[]; - /** - * HTTP response status code. - */ - responseStatusCode: number; - /** - * HTTP response body. This will return empty unless execution is created as synchronous. - */ - responseBody: string; - /** - * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - */ - responseHeaders: Headers[]; - /** - * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - logs: string; - /** - * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - errors: string; - /** - * Resource(function/site) execution duration in seconds. - */ - duration: number; - /** - * The scheduled time for execution. If left empty, execution will be queued immediately. - */ - scheduledAt?: string; - } - - /** - * Project - */ - export type Project = { - /** - * Project ID. - */ - $id: string; - /** - * Project creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Project update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * 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. - */ - devKeys: DevKey[]; - /** - * Status for custom SMTP - */ - smtpEnabled: boolean; - /** - * SMTP sender name - */ - smtpSenderName: string; - /** - * SMTP sender email - */ - smtpSenderEmail: string; - /** - * SMTP reply to name - */ - smtpReplyToName: string; - /** - * SMTP reply to email - */ - smtpReplyToEmail: string; - /** - * SMTP server host name - */ - smtpHost: string; - /** - * SMTP server port - */ - smtpPort: number; - /** - * SMTP server username - */ - smtpUsername: string; - /** - * SMTP server password. This property is write-only and always returned empty. - */ - smtpPassword: string; - /** - * SMTP server secure protocol - */ - smtpSecure: string; - /** - * Number of times the ping was received for this project. - */ - pingCount: number; - /** - * Last ping datetime in ISO 8601 format. - */ - pingedAt: string; - /** - * Labels for the project. - */ - labels: string[]; - /** - * Project status - */ - 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 - */ - authPhone: boolean; - /** - * Account service status - */ - serviceStatusForAccount: boolean; - /** - * Avatars service status - */ - serviceStatusForAvatars: boolean; - /** - * 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 - */ - serviceStatusForGraphql: boolean; - /** - * Migrations service status - */ - serviceStatusForMigrations: boolean; - /** - * Messaging service status - */ - serviceStatusForMessaging: boolean; - /** - * REST protocol status - */ - protocolStatusForRest: boolean; - /** - * GraphQL protocol status - */ - protocolStatusForGraphql: boolean; - /** - * Websocket protocol status - */ - protocolStatusForWebsocket: boolean; - /** - * Project region - */ - region: string; - /** - * Billing limits reached - */ - billingLimits: BillingLimits; - /** - * Project blocks information - */ - blocks: Block[]; - /** - * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. - */ - consoleAccessedAt: string; - } - - /** - * Webhook - */ - export type Webhook = { - /** - * Webhook ID. - */ - $id: string; - /** - * Webhook creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Webhook update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Webhook name. - */ - name: string; - /** - * Webhook URL endpoint. - */ - url: string; - /** - * Webhook trigger events. - */ - events: string[]; - /** - * Indicates if SSL / TLS certificate verification is enabled. - */ - tls: boolean; - /** - * HTTP basic authentication username. - */ - authUsername: string; - /** - * HTTP basic authentication password. - */ - authPassword: string; - /** - * Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. - */ - secret: string; - /** - * Indicates if this webhook is enabled. - */ - enabled: boolean; - /** - * Webhook error logs from the most recent failure. - */ - logs: string; - /** - * Number of consecutive failed webhook attempts. - */ - attempts: number; - } - - /** - * Key - */ - export type Key = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * Ephemeral Key - */ - export type EphemeralKey = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * DevKey - */ - export type DevKey = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * Mock Number - */ - export type MockNumber = { - /** - * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - */ - number: string; - /** - * Mock OTP for the number. - */ - otp: string; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - } - - /** - * OAuth2GitHub - */ - export type OAuth2Github = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. - */ - clientId: string; - /** - * GitHub OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Discord - */ - export type OAuth2Discord = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Discord OAuth2 client ID. - */ - clientId: string; - /** - * Discord OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Figma - */ - export type OAuth2Figma = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Figma OAuth2 client ID. - */ - clientId: string; - /** - * Figma OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Dropbox - */ - export type OAuth2Dropbox = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Dropbox OAuth2 app key. - */ - appKey: string; - /** - * Dropbox OAuth2 app secret. - */ - appSecret: string; - } - - /** - * OAuth2Dailymotion - */ - export type OAuth2Dailymotion = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Dailymotion OAuth2 API key. - */ - apiKey: string; - /** - * Dailymotion OAuth2 API secret. - */ - apiSecret: string; - } - - /** - * OAuth2Bitbucket - */ - export type OAuth2Bitbucket = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Bitbucket OAuth2 key. - */ - key: string; - /** - * Bitbucket OAuth2 secret. - */ - secret: string; - } - - /** - * OAuth2Bitly - */ - export type OAuth2Bitly = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Bitly OAuth2 client ID. - */ - clientId: string; - /** - * Bitly OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Box - */ - export type OAuth2Box = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Box OAuth2 client ID. - */ - clientId: string; - /** - * Box OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Autodesk - */ - export type OAuth2Autodesk = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Autodesk OAuth2 client ID. - */ - clientId: string; - /** - * Autodesk OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Google - */ - export type OAuth2Google = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Google OAuth2 client ID. - */ - clientId: string; - /** - * Google OAuth2 client secret. - */ - clientSecret: string; - /** - * Google OAuth2 prompt values. - */ - prompt: OAuth2GooglePrompt[]; - } - - /** - * OAuth2Zoom - */ - export type OAuth2Zoom = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Zoom OAuth2 client ID. - */ - clientId: string; - /** - * Zoom OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Zoho - */ - export type OAuth2Zoho = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Zoho OAuth2 client ID. - */ - clientId: string; - /** - * Zoho OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Yandex - */ - export type OAuth2Yandex = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Yandex OAuth2 client ID. - */ - clientId: string; - /** - * Yandex OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2X - */ - export type OAuth2X = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * X OAuth2 customer key. - */ - customerKey: string; - /** - * X OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2WordPress - */ - export type OAuth2WordPress = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * WordPress OAuth2 client ID. - */ - clientId: string; - /** - * WordPress OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Twitch - */ - export type OAuth2Twitch = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Twitch OAuth2 client ID. - */ - clientId: string; - /** - * Twitch OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Stripe - */ - export type OAuth2Stripe = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Stripe OAuth2 client ID. - */ - clientId: string; - /** - * Stripe OAuth2 API secret key. - */ - apiSecretKey: string; - } - - /** - * OAuth2Spotify - */ - export type OAuth2Spotify = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Spotify OAuth2 client ID. - */ - clientId: string; - /** - * Spotify OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Slack - */ - export type OAuth2Slack = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Slack OAuth2 client ID. - */ - clientId: string; - /** - * Slack OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Podio - */ - export type OAuth2Podio = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Podio OAuth2 client ID. - */ - clientId: string; - /** - * Podio OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Notion - */ - export type OAuth2Notion = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Notion OAuth2 client ID. - */ - oauthClientId: string; - /** - * Notion OAuth2 client secret. - */ - oauthClientSecret: string; - } - - /** - * OAuth2Salesforce - */ - export type OAuth2Salesforce = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Salesforce OAuth2 consumer key. - */ - customerKey: string; - /** - * Salesforce OAuth2 consumer secret. - */ - customerSecret: string; - } - - /** - * OAuth2Yahoo - */ - export type OAuth2Yahoo = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Yahoo OAuth2 client ID. - */ - clientId: string; - /** - * Yahoo OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Linkedin - */ - export type OAuth2Linkedin = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * LinkedIn OAuth2 client ID. - */ - clientId: string; - /** - * LinkedIn OAuth2 primary client secret. - */ - primaryClientSecret: string; - } - - /** - * OAuth2Disqus - */ - export type OAuth2Disqus = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Disqus OAuth2 public key. - */ - publicKey: string; - /** - * Disqus OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2Amazon - */ - export type OAuth2Amazon = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Amazon OAuth2 client ID. - */ - clientId: string; - /** - * Amazon OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Etsy - */ - export type OAuth2Etsy = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Etsy OAuth2 keystring. - */ - keyString: string; - /** - * Etsy OAuth2 shared secret. - */ - sharedSecret: string; - } - - /** - * OAuth2Facebook - */ - export type OAuth2Facebook = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Facebook OAuth2 app ID. - */ - appId: string; - /** - * Facebook OAuth2 app secret. - */ - appSecret: string; - } - - /** - * OAuth2Tradeshift - */ - export type OAuth2Tradeshift = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Tradeshift OAuth2 client ID. - */ - oauth2ClientId: string; - /** - * Tradeshift OAuth2 client secret. - */ - oauth2ClientSecret: string; - } - - /** - * OAuth2Paypal - */ - export type OAuth2Paypal = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * PayPal OAuth2 client ID. - */ - clientId: string; - /** - * PayPal OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2Gitlab - */ - export type OAuth2Gitlab = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * GitLab OAuth2 application ID. - */ - applicationId: string; - /** - * GitLab OAuth2 secret. - */ - secret: string; - /** - * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. - */ - endpoint: string; - } - - /** - * OAuth2Authentik - */ - export type OAuth2Authentik = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Authentik OAuth2 client ID. - */ - clientId: string; - /** - * Authentik OAuth2 client secret. - */ - clientSecret: string; - /** - * Authentik OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2Auth0 - */ - export type OAuth2Auth0 = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Auth0 OAuth2 client ID. - */ - clientId: string; - /** - * Auth0 OAuth2 client secret. - */ - clientSecret: string; - /** - * Auth0 OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2FusionAuth - */ - export type OAuth2FusionAuth = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * FusionAuth OAuth2 client ID. - */ - clientId: string; - /** - * FusionAuth OAuth2 client secret. - */ - clientSecret: string; - /** - * FusionAuth OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2Keycloak - */ - export type OAuth2Keycloak = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Keycloak OAuth2 client ID. - */ - clientId: string; - /** - * Keycloak OAuth2 client secret. - */ - clientSecret: string; - /** - * Keycloak OAuth2 endpoint domain. - */ - endpoint: string; - /** - * Keycloak OAuth2 realm name. - */ - realmName: string; - } - - /** - * OAuth2Oidc - */ - export type OAuth2Oidc = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * OpenID Connect OAuth2 client ID. - */ - clientId: string; - /** - * OpenID Connect OAuth2 client secret. - */ - clientSecret: string; - /** - * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. - */ - wellKnownURL: string; - /** - * OpenID Connect authorization endpoint URL. - */ - authorizationURL: string; - /** - * OpenID Connect token endpoint URL. - */ - tokenURL: string; - /** - * OpenID Connect user info endpoint URL. - */ - userInfoURL: string; - } - - /** - * OAuth2Okta - */ - export type OAuth2Okta = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Okta OAuth2 client ID. - */ - clientId: string; - /** - * Okta OAuth2 client secret. - */ - clientSecret: string; - /** - * Okta OAuth2 domain. - */ - domain: string; - /** - * Okta OAuth2 authorization server ID. - */ - authorizationServerId: string; - } - - /** - * OAuth2Kick - */ - export type OAuth2Kick = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Kick OAuth2 client ID. - */ - clientId: string; - /** - * Kick OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Apple - */ - export type OAuth2Apple = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Apple OAuth2 service ID. - */ - serviceId: string; - /** - * Apple OAuth2 key ID. - */ - keyId: string; - /** - * Apple OAuth2 team ID. - */ - teamId: string; - /** - * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. - */ - p8File: string; - } - - /** - * OAuth2Microsoft - */ - export type OAuth2Microsoft = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Microsoft OAuth2 application ID. - */ - applicationId: string; - /** - * Microsoft OAuth2 application secret. - */ - applicationSecret: string; - /** - * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. - */ - tenant: string; - } - - /** - * OAuth2 Providers List - */ - export type OAuth2ProviderList = { - /** - * Total number of OAuth2 providers in the given project. - */ - total: number; - /** - * List of OAuth2 providers. - */ - providers: (Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; - } - - /** - * Policy Password Dictionary - */ - export type PolicyPasswordDictionary = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether password dictionary policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Password History - */ - export type PolicyPasswordHistory = { - /** - * Policy ID. - */ - $id: string; - /** - * Password history length. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy Password Personal Data - */ - export type PolicyPasswordPersonalData = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether password personal data policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Alert - */ - export type PolicySessionAlert = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether session alert policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Duration - */ - export type PolicySessionDuration = { - /** - * Policy ID. - */ - $id: string; - /** - * Session duration in seconds. - */ - duration: number; - } - - /** - * Policy Session Invalidation - */ - export type PolicySessionInvalidation = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether session invalidation policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Limit - */ - export type PolicySessionLimit = { - /** - * Policy ID. - */ - $id: string; - /** - * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy User Limit - */ - export type PolicyUserLimit = { - /** - * Policy ID. - */ - $id: string; - /** - * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy Membership Privacy - */ - export type PolicyMembershipPrivacy = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether user ID is visible in memberships. - */ - userId: boolean; - /** - * Whether user email is visible in memberships. - */ - userEmail: boolean; - /** - * Whether user phone is visible in memberships. - */ - userPhone: boolean; - /** - * Whether user name is visible in memberships. - */ - userName: boolean; - /** - * Whether user MFA status is visible in memberships. - */ - userMFA: boolean; - } - - /** - * AuthProvider - */ - export type AuthProvider = { - /** - * Auth Provider. - */ - key: string; - /** - * Auth Provider name. - */ - name: string; - /** - * OAuth 2.0 application ID. - */ - appId: string; - /** - * OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. - */ - secret: string; - /** - * Auth Provider is active and can be used to create session. - */ - enabled: boolean; - } - - /** - * Platform Web - */ - export type PlatformWeb = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Web app hostname. Empty string for other platforms. - */ - hostname: string; - } - - /** - * Platform Apple - */ - export type PlatformApple = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Apple bundle identifier. - */ - bundleIdentifier: string; - } - - /** - * Platform Android - */ - export type PlatformAndroid = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Android application ID. - */ - applicationId: string; - } - - /** - * Platform Windows - */ - export type PlatformWindows = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Windows package identifier name. - */ - packageIdentifierName: string; - } - - /** - * Platform Linux - */ - export type PlatformLinux = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Linux package name. - */ - packageName: string; - } - - /** - * Platforms List - */ - export type PlatformList = { - /** - * Total number of platforms in the given project. - */ - total: number; - /** - * List of platforms. - */ - platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; - } - - /** - * Variable - */ - export type Variable = { - /** - * Variable ID. - */ - $id: string; - /** - * Variable creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Variable creation date in ISO 8601 format. - */ - $updatedAt: string; + responseBody: string; /** - * Variable key. + * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. */ - key: string; + responseHeaders: Headers[]; /** - * Variable value. + * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. */ - value: string; + logs: string; /** - * Variable secret flag. Secret variables can only be updated or deleted, but never read. + * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. */ - secret: boolean; + errors: string; /** - * Service to which the variable belongs. Possible values are "project", "function" + * Resource(function/site) execution duration in seconds. */ - resourceType: string; + duration: number; /** - * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + * The scheduled time for execution. If left empty, execution will be queued immediately. */ - resourceId: string; + scheduledAt?: string; } /** @@ -5977,96 +1282,6 @@ export namespace Models { countryName: string; } - /** - * Health Antivirus - */ - export type HealthAntivirus = { - /** - * Antivirus version. - */ - version: string; - /** - * Antivirus status. Possible values are: `disabled`, `offline`, `online` - */ - status: HealthAntivirusStatus; - } - - /** - * Health Queue - */ - export type HealthQueue = { - /** - * Amount of actions in the queue. - */ - size: number; - } - - /** - * Health Status - */ - export type HealthStatus = { - /** - * Name of the service. - */ - name: string; - /** - * Duration in milliseconds how long the health check took. - */ - ping: number; - /** - * Service status. Possible values are: `pass`, `fail` - */ - status: HealthCheckStatus; - } - - /** - * Health Certificate - */ - export type HealthCertificate = { - /** - * Certificate name - */ - name: string; - /** - * Subject SN - */ - subjectSN: string; - /** - * Issuer organisation - */ - issuerOrganisation: string; - /** - * Valid from - */ - validFrom: string; - /** - * Valid to - */ - validTo: string; - /** - * Signature type SN - */ - signatureTypeSN: string; - } - - /** - * Health Time - */ - export type HealthTime = { - /** - * Current unix timestamp on trustful remote server. - */ - remoteTime: number; - /** - * Current unix timestamp of local server where Appwrite runs. - */ - localTime: number; - /** - * Difference of unix remote and local timestamps in milliseconds. - */ - diff: number; - } - /** * Headers */ @@ -6081,336 +1296,72 @@ export namespace Models { value: string; } - /** - * Specification - */ - export type Specification = { - /** - * Memory size in MB. - */ - memory: number; - /** - * Number of CPUs. - */ - cpus: number; - /** - * Is size enabled. - */ - enabled: boolean; - /** - * Size slug. - */ - slug: string; - } - - /** - * Rule - */ - export type ProxyRule = { - /** - * Rule ID. - */ - $id: string; - /** - * Rule creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Rule update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Domain name. - */ - domain: string; - /** - * Action definition for the rule. Possible values are "api", "deployment", or "redirect" - */ - type: string; - /** - * Defines how the rule was created. Possible values are "manual" or "deployment" - */ - trigger: string; - /** - * URL to redirect to. Used if type is "redirect" - */ - redirectUrl: string; - /** - * Status code to apply during redirect. Used if type is "redirect" - */ - redirectStatusCode: number; - /** - * ID of deployment. Used if type is "deployment" - */ - deploymentId: string; - /** - * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". - */ - deploymentResourceType?: ProxyRuleDeploymentResourceType; - /** - * ID of deployment's resource (site or function ID). Used if type is "deployment" - */ - deploymentResourceId: string; - /** - * Name of Git branch that updates rule. Used if type is "deployment" - */ - deploymentVcsProviderBranch: string; - /** - * Domain verification status. Possible values are "unverified", "verifying", "verified" - */ - status: ProxyRuleStatus; - /** - * Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. - */ - logs: string; - /** - * Certificate auto-renewal date in ISO 8601 format. - */ - renewAt: string; - } - - /** - * EmailTemplate - */ - export type EmailTemplate = { - /** - * Template type - */ - templateId: string; - /** - * Template locale - */ - locale: string; - /** - * Template message - */ - message: string; - /** - * Name of the sender - */ - senderName: string; - /** - * Email of the sender - */ - senderEmail: string; - /** - * Reply to email address - */ - replyToEmail: string; - /** - * Reply to name - */ - replyToName: string; - /** - * Email subject - */ - subject: string; - } - /** * MFA Challenge */ - export type MfaChallenge = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User ID. - */ - userId: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - } - - /** - * MFA Recovery Codes - */ - export type MfaRecoveryCodes = { - /** - * Recovery codes. - */ - recoveryCodes: string[]; - } - - /** - * MFAType - */ - export type MfaType = { - /** - * Secret token used for TOTP factor. - */ - secret: string; - /** - * URI for authenticator apps. - */ - uri: string; - } - - /** - * MFAFactors - */ - export type MfaFactors = { - /** - * Can TOTP be used for MFA challenge for this account. - */ - totp: boolean; - /** - * Can phone (SMS) be used for MFA challenge for this account. - */ - phone: boolean; - /** - * Can email be used for MFA challenge for this account. - */ - email: boolean; - /** - * Can recovery code be used for MFA challenge for this account. - */ - recoveryCode: boolean; - } - - /** - * Provider - */ - export type Provider = { - /** - * Provider ID. - */ - $id: string; - /** - * Provider creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Provider update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The name for the provider instance. - */ - name: string; - /** - * The name of the provider service. - */ - provider: string; - /** - * Is provider enabled? - */ - enabled: boolean; - /** - * Type of provider. - */ - type: string; - /** - * Provider credentials. - */ - credentials: object; - /** - * Provider options. - */ - options?: object; - } - - /** - * Message - */ - export type Message = { - /** - * Message ID. - */ - $id: string; - /** - * Message creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Message update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Message provider type. - */ - providerType: string; - /** - * Topic IDs set as recipients. - */ - topics: string[]; - /** - * User IDs set as recipients. - */ - users: string[]; - /** - * Target IDs set as recipients. - */ - targets: string[]; - /** - * The scheduled time for message. - */ - scheduledAt?: string; - /** - * The time when the message was delivered. - */ - deliveredAt?: string; + export type MfaChallenge = { /** - * Delivery errors if any. + * Token ID. */ - deliveryErrors?: string[]; + $id: string; /** - * Number of recipients the message was delivered to. + * Token creation date in ISO 8601 format. */ - deliveredTotal: number; + $createdAt: string; /** - * Data of the message. + * User ID. */ - data: object; + userId: string; /** - * Status of delivery. + * Token expiration date in ISO 8601 format. */ - status: MessageStatus; + expire: string; } /** - * Topic + * MFA Recovery Codes */ - export type Topic = { - /** - * Topic ID. - */ - $id: string; + export type MfaRecoveryCodes = { /** - * Topic creation time in ISO 8601 format. + * Recovery codes. */ - $createdAt: string; + recoveryCodes: string[]; + } + + /** + * MFAType + */ + export type MfaType = { /** - * Topic update date in ISO 8601 format. + * Secret token used for TOTP factor. */ - $updatedAt: string; + secret: string; /** - * The name of the topic. + * URI for authenticator apps. */ - name: string; + uri: string; + } + + /** + * MFAFactors + */ + export type MfaFactors = { /** - * Total count of email subscribers subscribed to the topic. + * Can TOTP be used for MFA challenge for this account. */ - emailTotal: number; + totp: boolean; /** - * Total count of SMS subscribers subscribed to the topic. + * Can phone (SMS) be used for MFA challenge for this account. */ - smsTotal: number; + phone: boolean; /** - * Total count of push subscribers subscribed to the topic. + * Can email be used for MFA challenge for this account. */ - pushTotal: number; + email: boolean; /** - * Subscribe permissions. + * Can recovery code be used for MFA challenge for this account. */ - subscribe: string[]; + recoveryCode: boolean; } /** @@ -6528,430 +1479,152 @@ export namespace Models { } /** - * ActivityEvent - */ - export type ActivityEvent = { - /** - * Event ID. - */ - $id: string; - /** - * User type. - */ - userType: string; - /** - * User ID. - */ - userId: string; - /** - * User Email. - */ - userEmail: string; - /** - * User Name. - */ - userName: string; - /** - * Resource parent. - */ - resourceParent: string; - /** - * Resource type. - */ - resourceType: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource. - */ - resource: string; - /** - * Event name. - */ - event: string; - /** - * User agent. - */ - userAgent: string; - /** - * IP address. - */ - ip: string; - /** - * API mode when event triggered. - */ - mode: string; - /** - * Location. - */ - country: string; - /** - * Log creation date in ISO 8601 format. - */ - time: string; - /** - * Project ID. - */ - projectId: string; - /** - * Team ID. - */ - teamId: string; - /** - * Hostname. - */ - hostname: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * Archive + * Insight */ - export type BackupArchive = { + export type Insight = { /** - * Archive ID. + * Insight ID. */ $id: string; /** - * Archive creation time in ISO 8601 format. + * Insight creation date in ISO 8601 format. */ $createdAt: string; /** - * Archive update date in ISO 8601 format. + * Insight update date in ISO 8601 format. */ $updatedAt: string; /** - * Archive policy ID. - */ - policyId: string; - /** - * Archive size in bytes. - */ - size: number; - /** - * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this archive. - */ - services: string[]; - /** - * The resources that are backed up by this archive. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this archive should backup a single resource. - */ - resourceId?: string; - /** - * The resource type to backup. Set only if this archive should backup a single resource. - */ - resourceType?: string; - } - - /** - * BillingLimits - */ - export type BillingLimits = { - /** - * Bandwidth limit - */ - bandwidth: number; - /** - * Storage limit - */ - storage: number; - /** - * Users limit - */ - users: number; - /** - * Executions limit - */ - executions: number; - /** - * GBHours limit - */ - GBHours: number; - /** - * Image transformations limit + * Parent report ID. Insights always belong to a report. */ - imageTransformations: number; + reportId: string; /** - * Auth phone limit + * 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). */ - authPhone: number; + type: string; /** - * Budget limit percentage + * Insight severity. One of info, warning, critical. */ - budgetLimit: number; - } - - /** - * Block - */ - export type Block = { + severity: string; /** - * Block creation date in ISO 8601 format. + * Insight status. One of active, dismissed. */ - $createdAt: string; + status: string; /** - * Resource type that is blocked + * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. */ resourceType: string; /** - * Resource identifier that is blocked + * ID of the resource the insight is about. */ resourceId: string; /** - * Reason for the block. Can be null if no reason was provided. + * 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. */ - reason?: string; + parentResourceId: string; /** - * Block expiration date in ISO 8601 format. Can be null if the block does not expire. + * Insight title. */ - expiredAt?: string; + title: string; /** - * Name of the project this block applies to. + * Short markdown summary describing the insight. */ - projectName: string; + summary: string; /** - * Region of the project this block applies to. + * List of call-to-action buttons attached to this insight. */ - region: string; + ctas: InsightCTA[]; /** - * Name of the organization that owns the project. + * Time the insight was analyzed in ISO 8601 format. */ - organizationName: string; + analyzedAt?: string; /** - * ID of the organization that owns the project. + * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. */ - organizationId: string; + dismissedAt?: string; /** - * Billing plan of the organization that owns the project. + * User ID that dismissed the insight. Empty when not dismissed. */ - billingPlan: string; + dismissedBy?: string; } /** - * backup + * InsightCTA */ - export type BackupPolicy = { - /** - * Backup policy ID. - */ - $id: string; - /** - * Backup policy name. - */ - name: string; - /** - * Policy creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Policy update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this policy should backup a single resource. - */ - resourceId?: string; + export type InsightCTA = { /** - * The resource type to backup. Set only if this policy should backup a single resource. + * Human-readable label for the CTA, used in UI. */ - resourceType?: string; + label: string; /** - * How many days to keep the backup before it will be automatically deleted. + * 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. */ - retention: number; + service: string; /** - * Policy backup schedule in CRON format. + * Public API method on the chosen service the client should invoke when this CTA is triggered. */ - schedule: string; + method: string; /** - * Is this policy enabled. + * 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). */ - enabled: boolean; + params: object; } /** - * Restoration + * Report */ - export type BackupRestoration = { + export type Report = { /** - * Restoration ID. + * Report ID. */ $id: string; /** - * Restoration creation time in ISO 8601 format. + * Report creation date in ISO 8601 format. */ $createdAt: string; /** - * Restoration update date in ISO 8601 format. + * Report update date in ISO 8601 format. */ $updatedAt: string; /** - * Backup archive ID. - */ - archiveId: string; - /** - * Backup policy ID. - */ - policyId: string; - /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. + * ID of the third-party app that submitted the report. */ - resources: string[]; - /** - * Optional data in key-value object. - */ - options: string; - } - - /** - * Activity event list - */ - export type ActivityEventList = { + appId: string; /** - * Total number of events that matched your query. + * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. */ - total: number; + type: string; /** - * List of events. + * Short, human-readable title for the report. */ - events: ActivityEvent[]; - } - - /** - * Backup archive list - */ - export type BackupArchiveList = { + title: string; /** - * Total number of archives that matched your query. + * Markdown summary describing the report. */ - total: number; + summary: string; /** - * List of archives. + * Plural noun describing what the report analyzes, e.g. databases, sites, urls. */ - archives: BackupArchive[]; - } - - /** - * Backup policy list - */ - export type BackupPolicyList = { + targetType: string; /** - * Total number of policies that matched your query. + * Free-form target identifier (URL for lighthouse, resource ID for db). */ - total: number; + target: string; /** - * List of policies. + * Categories covered by the report, e.g. performance, accessibility. */ - policies: BackupPolicy[]; - } - - /** - * Backup restoration list - */ - export type BackupRestorationList = { + categories: string[]; /** - * Total number of restorations that matched your query. + * Insights nested under this report. */ - total: number; + insights: Insight[]; /** - * List of restorations. + * Time the report was analyzed in ISO 8601 format. */ - restorations: BackupRestoration[]; + analyzedAt?: string; } } diff --git a/src/services/account.ts b/src/services/account.ts index 0994708d..5a3f7926 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1,25 +1,15 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { AuthenticatorType } from '../enums/authenticator-type'; import { AuthenticationFactor } from '../enums/authentication-factor'; import { OAuthProvider } from '../enums/o-auth-provider'; -type AccountServerOnlyMethod = never; -type AccountClientOnlyMethod = never; +export class Account { + client: Client; -export type Account<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<AccountRuntime<TAuth>, 'client' | AccountServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<AccountRuntime<TAuth>, 'client' | AccountClientOnlyMethod> - : Omit<AccountRuntime<TAuth>, 'client'>; - -class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -1865,6 +1855,95 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. + * + * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {void | string} + */ + createOAuth2Session(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string; + /** + * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. + * + * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. + * @throws {AppwriteException} + * @returns {void | string} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string; + createOAuth2Session( + paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider, + ...rest: [(string)?, (string)?, (string[])?] + ): void | string { + let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; + } else { + params = { + provider: paramsOrFirst as OAuthProvider, + success: rest[0] as string, + failure: rest[1] as string, + scopes: rest[2] as string[] + }; + } + + const provider = params.provider; + const success = params.success; + const failure = params.failure; + const scopes = params.scopes; + + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); + } + + const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider); + const payload: Payload = {}; + if (typeof success !== 'undefined') { + payload['success'] = success; + } + if (typeof failure !== 'undefined') { + payload['failure'] = failure; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + payload['project'] = this.client.config.project; + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + + if (typeof window !== 'undefined' && window?.location) { + window.location.href = uri.toString(); + return; + } else { + return uri.toString(); + } + } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -2177,6 +2256,194 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model. + * + * @param {string} params.targetId - Target 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.identifier - The target identifier (token, email, phone etc.) + * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + createPushTarget(params: { targetId: string, identifier: string, providerId?: string }): Promise<Models.Target>; + /** + * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model. + * + * @param {string} targetId - Target 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} identifier - The target identifier (token, email, phone etc.) + * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>; + createPushTarget( + paramsOrFirst: { targetId: string, identifier: string, providerId?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Target> { + let params: { targetId: string, identifier: string, providerId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { targetId: string, identifier: string, providerId?: string }; + } else { + params = { + targetId: paramsOrFirst as string, + identifier: rest[0] as string, + providerId: rest[1] as string + }; + } + + const targetId = params.targetId; + const identifier = params.identifier; + const providerId = params.providerId; + + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + if (typeof identifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "identifier"'); + } + + const apiPath = '/account/targets/push'; + const payload: Payload = {}; + if (typeof targetId !== 'undefined') { + payload['targetId'] = targetId; + } + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead. + * + * @param {string} params.targetId - Target ID. + * @param {string} params.identifier - The target identifier (token, email, phone etc.) + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + updatePushTarget(params: { targetId: string, identifier: string }): Promise<Models.Target>; + /** + * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead. + * + * @param {string} targetId - Target ID. + * @param {string} identifier - The target identifier (token, email, phone etc.) + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>; + updatePushTarget( + paramsOrFirst: { targetId: string, identifier: string } | string, + ...rest: [(string)?] + ): Promise<Models.Target> { + let params: { targetId: string, identifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { targetId: string, identifier: string }; + } else { + params = { + targetId: paramsOrFirst as string, + identifier: rest[0] as string + }; + } + + const targetId = params.targetId; + const identifier = params.identifier; + + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + if (typeof identifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "identifier"'); + } + + const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId); + const payload: Payload = {}; + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user. + * + * @param {string} params.targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePushTarget(params: { targetId: string }): Promise<{}>; + /** + * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user. + * + * @param {string} targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePushTarget(targetId: string): Promise<{}>; + deletePushTarget( + paramsOrFirst: { targetId: string } | string + ): Promise<{}> { + let params: { targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { targetId: string }; + } else { + params = { + targetId: paramsOrFirst as string + }; + } + + const targetId = params.targetId; + + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId); + 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 + ); + } + /** * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. * @@ -2415,8 +2682,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -2846,9 +3112,3 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } } - -const Account = AccountRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Account<TAuth>; -}; - -export { Account }; diff --git a/src/services/activities.ts b/src/services/activities.ts deleted file mode 100644 index fa15e6dc..00000000 --- a/src/services/activities.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Activities = Omit<ActivitiesRuntime, 'client'>; - -class ActivitiesRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * List all events for selected filters. - * - * @param {string} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEventList>} - */ - listEvents(params?: { queries?: string }): Promise<Models.ActivityEventList>; - /** - * List all events for selected filters. - * - * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEventList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEvents(queries?: string): Promise<Models.ActivityEventList>; - listEvents( - paramsOrFirst?: { queries?: string } | string - ): Promise<Models.ActivityEventList> { - let params: { queries?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string }; - } else { - params = { - queries: paramsOrFirst as string - }; - } - - const queries = params.queries; - - - const apiPath = '/activities/events'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get event by ID. - * - * - * @param {string} params.eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEvent>} - */ - getEvent(params: { eventId: string }): Promise<Models.ActivityEvent>; - /** - * Get event by ID. - * - * - * @param {string} eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEvent>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getEvent(eventId: string): Promise<Models.ActivityEvent>; - getEvent( - paramsOrFirst: { eventId: string } | string - ): Promise<Models.ActivityEvent> { - let params: { eventId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { eventId: string }; - } else { - params = { - eventId: paramsOrFirst as string - }; - } - - const eventId = params.eventId; - - if (typeof eventId === 'undefined') { - throw new AppwriteException('Missing required parameter: "eventId"'); - } - - const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } -} - -const Activities = ActivitiesRuntime as unknown as { - new (client: Client<ServerAuth>): Activities; -}; - -export { Activities }; diff --git a/src/services/advisor.ts b/src/services/advisor.ts new file mode 100644 index 00000000..a2365390 --- /dev/null +++ b/src/services/advisor.ts @@ -0,0 +1,255 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Advisor { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ReportList>} + */ + listReports(params?: { queries?: string[], total?: boolean }): Promise<Models.ReportList>; + /** + * 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<Models.ReportList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listReports(queries?: string[], total?: boolean): Promise<Models.ReportList>; + listReports( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.ReportList> { + 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<Models.Report>} + */ + getReport(params: { reportId: string }): Promise<Models.Report>; + /** + * 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<Models.Report>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReport(reportId: string): Promise<Models.Report>; + getReport( + paramsOrFirst: { reportId: string } | string + ): Promise<Models.Report> { + 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 + ); + } + + /** + * 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<Models.InsightList>} + */ + listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise<Models.InsightList>; + /** + * 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<Models.InsightList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInsights(reportId: string, queries?: string[], total?: boolean): Promise<Models.InsightList>; + listInsights( + paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.InsightList> { + 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<Models.Insight>} + */ + getInsight(params: { reportId: string, insightId: string }): Promise<Models.Insight>; + /** + * 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<Models.Insight>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInsight(reportId: string, insightId: string): Promise<Models.Insight>; + getInsight( + paramsOrFirst: { reportId: string, insightId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Insight> { + 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/avatars.ts b/src/services/avatars.ts index a84754a5..eea5a0f8 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,5 +1,5 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { Browser } from '../enums/browser'; @@ -10,20 +10,10 @@ import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; -type AvatarsServerOnlyMethod = never; -type AvatarsClientOnlyMethod = never; +export class Avatars { + client: Client; -export type Avatars<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsClientOnlyMethod> - : Omit<AvatarsRuntime<TAuth>, 'client'>; - -class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -96,8 +86,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -177,8 +166,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -237,8 +225,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -318,8 +305,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -397,8 +383,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -482,8 +467,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -562,8 +546,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -760,8 +743,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -770,9 +752,3 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server return uri.toString(); } } - -const Avatars = AvatarsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Avatars<TAuth>; -}; - -export { Avatars }; diff --git a/src/services/backups.ts b/src/services/backups.ts deleted file mode 100644 index 29005f77..00000000 --- a/src/services/backups.ts +++ /dev/null @@ -1,761 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { BackupServices } from '../enums/backup-services'; - -export type Backups = Omit<BackupsRuntime, 'client'>; - -class BackupsRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * List all archives for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchiveList>} - */ - listArchives(params?: { queries?: string[] }): Promise<Models.BackupArchiveList>; - /** - * List all archives for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchiveList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listArchives(queries?: string[]): Promise<Models.BackupArchiveList>; - listArchives( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupArchiveList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} params.services - Array of services to backup - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - */ - createArchive(params: { services: BackupServices[], resourceId?: string }): Promise<Models.BackupArchive>; - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} services - Array of services to backup - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createArchive(services: BackupServices[], resourceId?: string): Promise<Models.BackupArchive>; - createArchive( - paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], - ...rest: [(string)?] - ): Promise<Models.BackupArchive> { - let params: { services: BackupServices[], resourceId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { services: BackupServices[], resourceId?: string }; - } else { - params = { - services: paramsOrFirst as BackupServices[], - resourceId: rest[0] as string - }; - } - - const services = params.services; - const resourceId = params.resourceId; - - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a backup archive using it's ID. - * - * @param {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - */ - getArchive(params: { archiveId: string }): Promise<Models.BackupArchive>; - /** - * Get a backup archive using it's ID. - * - * @param {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getArchive(archiveId: string): Promise<Models.BackupArchive>; - getArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<Models.BackupArchive> { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete an existing archive for a project. - * - * @param {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteArchive(params: { archiveId: string }): Promise<{}>; - /** - * Delete an existing archive for a project. - * - * @param {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteArchive(archiveId: string): Promise<{}>; - deleteArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<{}> { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * List all policies for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicyList>} - */ - listPolicies(params?: { queries?: string[] }): Promise<Models.BackupPolicyList>; - /** - * List all policies for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPolicies(queries?: string[]): Promise<Models.BackupPolicyList>; - listPolicies( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupPolicyList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new backup policy. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {BackupServices[]} params.services - Array of services to backup - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Schedule CRON syntax. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; - /** - * Create a new backup policy. - * - * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {BackupServices[]} services - Array of services to backup - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Schedule CRON syntax. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>; - createPolicy( - paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, - ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.BackupPolicy> { - let params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - retention: rest[1] as number, - schedule: rest[2] as string, - name: rest[3] as string, - resourceId: rest[4] as string, - enabled: rest[5] as boolean - }; - } - - const policyId = params.policyId; - const services = params.services; - const retention = params.retention; - const schedule = params.schedule; - const name = params.name; - const resourceId = params.resourceId; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - if (typeof retention === 'undefined') { - throw new AppwriteException('Missing required parameter: "retention"'); - } - if (typeof schedule === 'undefined') { - throw new AppwriteException('Missing required parameter: "schedule"'); - } - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof policyId !== 'undefined') { - payload['policyId'] = policyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a backup policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - getPolicy(params: { policyId: string }): Promise<Models.BackupPolicy>; - /** - * Get a backup policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPolicy(policyId: string): Promise<Models.BackupPolicy>; - getPolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<Models.BackupPolicy> { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an existing policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Cron expression - * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; - /** - * Update an existing policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Cron expression - * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy>; - updatePolicy( - paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, - ...rest: [(string)?, (number)?, (string)?, (boolean)?] - ): Promise<Models.BackupPolicy> { - let params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - name: rest[0] as string, - retention: rest[1] as number, - schedule: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const policyId = params.policyId; - const name = params.name; - const retention = params.retention; - const schedule = params.schedule; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePolicy(params: { policyId: string }): Promise<{}>; - /** - * Delete a policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePolicy(policyId: string): Promise<{}>; - deletePolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<{}> { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} params.archiveId - Backup archive ID to restore - * @param {BackupServices[]} params.services - Array of services to restore - * @param {string} params.newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise<Models.BackupRestoration>; - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} archiveId - Backup archive ID to restore - * @param {BackupServices[]} services - Array of services to restore - * @param {string} newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration>; - createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?] - ): Promise<Models.BackupRestoration> { - let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - } else { - params = { - archiveId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - newResourceId: rest[1] as string, - newResourceName: rest[2] as string - }; - } - - const archiveId = params.archiveId; - const services = params.services; - const newResourceId = params.newResourceId; - const newResourceName = params.newResourceName; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/restoration'; - const payload: Payload = {}; - if (typeof archiveId !== 'undefined') { - payload['archiveId'] = archiveId; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof newResourceId !== 'undefined') { - payload['newResourceId'] = newResourceId; - } - if (typeof newResourceName !== 'undefined') { - payload['newResourceName'] = newResourceName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * List all backup restorations for a project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestorationList>} - */ - listRestorations(params?: { queries?: string[] }): Promise<Models.BackupRestorationList>; - /** - * List all backup restorations for a project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestorationList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRestorations(queries?: string[]): Promise<Models.BackupRestorationList>; - listRestorations( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupRestorationList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/restorations'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the current status of a backup restoration. - * - * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - */ - getRestoration(params: { restorationId: string }): Promise<Models.BackupRestoration>; - /** - * Get the current status of a backup restoration. - * - * @param {string} restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRestoration(restorationId: string): Promise<Models.BackupRestoration>; - getRestoration( - paramsOrFirst: { restorationId: string } | string - ): Promise<Models.BackupRestoration> { - let params: { restorationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { restorationId: string }; - } else { - params = { - restorationId: paramsOrFirst as string - }; - } - - const restorationId = params.restorationId; - - if (typeof restorationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "restorationId"'); - } - - const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } -} - -const Backups = BackupsRuntime as unknown as { - new (client: Client<ServerAuth>): Backups; -}; - -export { Backups }; diff --git a/src/services/databases.ts b/src/services/databases.ts index 334f3204..51a58d81 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1,171 +1,15 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { RelationshipType } from '../enums/relationship-type'; -import { RelationMutate } from '../enums/relation-mutate'; -import { DatabasesIndexType } from '../enums/databases-index-type'; -import { OrderBy } from '../enums/order-by'; -type DatabasesServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listCollections' | 'createCollection' | 'getCollection' | 'updateCollection' | 'deleteCollection' | 'listAttributes' | 'createBigIntAttribute' | 'updateBigIntAttribute' | 'createBooleanAttribute' | 'updateBooleanAttribute' | 'createDatetimeAttribute' | 'updateDatetimeAttribute' | 'createEmailAttribute' | 'updateEmailAttribute' | 'createEnumAttribute' | 'updateEnumAttribute' | 'createFloatAttribute' | 'updateFloatAttribute' | 'createIntegerAttribute' | 'updateIntegerAttribute' | 'createIpAttribute' | 'updateIpAttribute' | 'createLineAttribute' | 'updateLineAttribute' | 'createLongtextAttribute' | 'updateLongtextAttribute' | 'createMediumtextAttribute' | 'updateMediumtextAttribute' | 'createPointAttribute' | 'updatePointAttribute' | 'createPolygonAttribute' | 'updatePolygonAttribute' | 'createRelationshipAttribute' | 'updateRelationshipAttribute' | 'createStringAttribute' | 'updateStringAttribute' | 'createTextAttribute' | 'updateTextAttribute' | 'createUrlAttribute' | 'updateUrlAttribute' | 'createVarcharAttribute' | 'updateVarcharAttribute' | 'getAttribute' | 'deleteAttribute' | 'upsertDocuments' | 'updateDocuments' | 'deleteDocuments' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex'; -type DatabasesClientOnlyMethod = never; +export class Databases { + client: Client; -export type Databases<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesClientOnlyMethod> - : Omit<DatabasesRuntime<TAuth>, 'client'>; - -class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. - */ - list(this: Databases<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(this: Databases<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.DatabaseList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/databases'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Database. - * - * - * @param {string} params.databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. - */ - create(this: Databases<ServerAuth>, params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Create a new Database. - * - * - * @param {string} databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(this: Databases<ServerAuth>, databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; - create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/databases'; - const payload: Payload = {}; - if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - /** * List transactions across all databases. * @@ -500,239 +344,80 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. - */ - get(this: Databases<ServerAuth>, params: { databaseId: string }): Promise<Models.Database>; - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(this: Databases<ServerAuth>, databaseId: string): Promise<Models.Database>; - get( - paramsOrFirst: { databaseId: string } | string - ): Promise<Models.Database> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a database by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. - */ - update(this: Databases<ServerAuth>, params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Update a database by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(this: Databases<ServerAuth>, databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; - update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. - */ - delete(this: Databases<ServerAuth>, params: { databaseId: string }): Promise<{}>; - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(this: Databases<ServerAuth>, databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @param {string} params.databaseId - Database ID. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for 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<Models.CollectionList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listCollections(this: Databases<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; + listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; /** - * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @param {string} databaseId - Database ID. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity - * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for 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<Models.CollectionList>} + * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - listCollections(this: Databases<ServerAuth>, databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; - listCollections( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.CollectionList> { - let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; + listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; + listDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number }; } const databaseId = params.databaseId; + const collectionId = params.collectionId; const queries = params.queries; - const search = params.search; + const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; } - if (typeof search !== 'undefined') { - payload['search'] = search; + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; } 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 } = { @@ -747,4617 +432,57 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Collection name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {object[]} params.attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} params.documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. */ - createCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; + createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; /** - * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Collection name. Max length: 128 chars. - * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {object[]} attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; - createCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - documentSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - attributes: rest[5] as object[], - indexes: rest[6] as object[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const name = params.name; - const permissions = params.permissions; - const documentSecurity = params.documentSecurity; - const enabled = params.enabled; - const attributes = params.attributes; - const indexes = params.indexes; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof collectionId !== 'undefined') { - payload['collectionId'] = collectionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; - } - if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. - */ - getCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; - /** - * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string): Promise<Models.Collection>; - getCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a collection by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.name - Collection name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {boolean} params.purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. - */ - updateCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; - /** - * Update a collection by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} name - Collection name. Max length: 128 chars. - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {boolean} purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; - updateCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - documentSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - purge: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const name = params.name; - const permissions = params.permissions; - const documentSecurity = params.documentSecurity; - const enabled = params.enabled; - const purge = params.purge; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. - */ - deleteCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string }): Promise<{}>; - /** - * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteCollection(this: Databases<ServerAuth>, databaseId: string, collectionId: string): Promise<{}>; - deleteCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - 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 attributes in the collection. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection 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: key, type, size, required, array, status, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. - */ - listAttributes(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; - /** - * List attributes in the collection. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection 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: key, type, size, required, array, status, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listAttributes(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; - listAttributes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.AttributeList> { - let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead. - */ - createBigIntAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; - /** - * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBigIntAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; - createBigIntAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.AttributeBigint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a bigint attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead. - */ - updateBigIntAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; - /** - * Update a bigint attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBigIntAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; - updateBigIntAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.AttributeBigint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a boolean attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. - */ - createBooleanAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; - /** - * Create a boolean attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBooleanAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; - createBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeBoolean> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a boolean attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. - */ - updateBooleanAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; - /** - * Update a boolean attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBooleanAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; - updateBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.AttributeBoolean> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a date time attribute according to the ISO 8601 standard. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. - */ - createDatetimeAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; - /** - * Create a date time attribute according to the ISO 8601 standard. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDatetimeAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; - createDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeDatetime> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a date time attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. - */ - updateDatetimeAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; - /** - * Update a date time attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDatetimeAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; - updateDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeDatetime> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an email attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. - */ - createEmailAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; - /** - * Create an email attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; - createEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeEmail> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an email attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. - */ - updateEmailAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; - /** - * Update an email attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; - updateEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeEmail> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {string[]} params.elements - Array of enum values. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. - */ - createEnumAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; - /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {string[]} elements - Array of enum values. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEnumAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; - createEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeEnum> { - let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an enum attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {string[]} params.elements - Updated list of enum values. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. - */ - updateEnumAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; - /** - * Update an enum attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {string[]} elements - Updated list of enum values. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEnumAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; - updateEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeEnum> { - let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a float attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number} params.min - Minimum value. - * @param {number} params.max - Maximum value. - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. - */ - createFloatAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; - /** - * Create a float attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number} min - Minimum value. - * @param {number} max - Maximum value. - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFloatAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; - createFloatAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] - ): Promise<Models.AttributeFloat> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a float attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {number} params.min - Minimum value. - * @param {number} params.max - Maximum value. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. - */ - updateFloatAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; - /** - * Update a float attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {number} min - Minimum value. - * @param {number} max - Maximum value. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFloatAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; - updateFloatAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.AttributeFloat> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. - */ - createIntegerAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; - /** - * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIntegerAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; - createIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.AttributeInteger> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an integer attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. - */ - updateIntegerAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; - /** - * Update an integer attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIntegerAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; - updateIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.AttributeInteger> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create IP address attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. - */ - createIpAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; - /** - * Create IP address attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIpAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; - createIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeIp> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an ip attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. - */ - updateIpAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; - /** - * Update an ip attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIpAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; - updateIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeIp> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric line attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. - */ - createLineAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; - /** - * Create a geometric line attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLineAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; - createLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributeLine> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a line attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. - */ - updateLineAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; - /** - * Update a line attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLineAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; - updateLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributeLine> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a longtext attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - */ - createLongtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; - /** - * Create a longtext attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLongtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; - createLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeLongtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a longtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - */ - updateLongtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; - /** - * Update a longtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLongtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; - updateLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeLongtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a mediumtext attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - */ - createMediumtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; - /** - * Create a mediumtext attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMediumtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; - createMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeMediumtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - */ - updateMediumtextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; - /** - * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMediumtextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; - updateMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeMediumtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric point attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. - */ - createPointAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; - /** - * Create a geometric point attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPointAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; - createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributePoint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a point attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. - */ - updatePointAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; - /** - * Update a point attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePointAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; - updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributePoint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric polygon attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. - */ - createPolygonAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; - /** - * Create a geometric polygon attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolygonAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; - createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributePolygon> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. - */ - updatePolygonAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; - /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolygonAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; - updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributePolygon> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.relatedCollectionId - Related Collection ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? - * @param {string} params.key - Attribute Key. - * @param {string} params.twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. - */ - createRelationshipAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; - /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} relatedCollectionId - Related Collection ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? - * @param {string} key - Attribute Key. - * @param {string} twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRelationshipAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; - createRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise<Models.AttributeRelationship> { - let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - relatedCollectionId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const relatedCollectionId = params.relatedCollectionId; - const type = params.type; - const twoWay = params.twoWay; - const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof relatedCollectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof relatedCollectionId !== 'undefined') { - payload['relatedCollectionId'] = relatedCollectionId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; - } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. - */ - updateRelationshipAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; - updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise<Models.AttributeRelationship> { - let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a string attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {number} params.size - Attribute size for text attributes, in number of characters. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. - */ - createStringAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; - /** - * Create a string attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {number} size - Attribute size for text attributes, in number of characters. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createStringAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; - createStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a string attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} params.size - Maximum size of the string attribute. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. - */ - updateStringAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; - /** - * Update a string attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} size - Maximum size of the string attribute. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStringAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; - updateStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a text attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - */ - createTextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; - /** - * Create a text attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; - createTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeText> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a text attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - */ - updateTextAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; - /** - * Update a text attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; - updateTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeText> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a URL attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. - */ - createUrlAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; - /** - * Create a URL attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createUrlAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; - createUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeUrl> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an url attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. - */ - updateUrlAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; - /** - * Update an url attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUrlAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; - updateUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeUrl> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a varchar attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {number} params.size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - */ - createVarcharAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; - /** - * Create a varchar attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {number} size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVarcharAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; - createVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeVarchar> { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a varchar attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} params.size - Maximum size of the varchar attribute. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - */ - updateVarcharAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; - /** - * Update a varchar attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} size - Maximum size of the varchar attribute. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVarcharAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; - updateVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.AttributeVarchar> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get attribute by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. - */ - getAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; - /** - * Get attribute by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; - getAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - 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 - ); - } - - /** - * Deletes an attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. - */ - deleteAttribute(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; - /** - * Deletes an attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteAttribute(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<{}>; - deleteAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for 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<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. - */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for 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<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; - listDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const transactionId = params.transactionId; - const total = params.total; - const ttl = params.ttl; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - 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 - ); - } - - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} params.documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. - */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON 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 {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; - createDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documentId !== 'undefined') { - payload['documentId'] = documentId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {object[]} params.documents - Array of documents data as JSON objects. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. - */ - createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {object[]} documents - Array of documents data as JSON objects. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; - createDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documents: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documents = params.documents; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documents === 'undefined') { - throw new AppwriteException('Missing required parameter: "documents"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documents !== 'undefined') { - payload['documents'] = documents; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. - */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {object[]} documents - Array of document data as JSON objects. May contain partial documents. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documents: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documents = params.documents; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documents === 'undefined') { - throw new AppwriteException('Missing required parameter: "documents"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documents !== 'undefined') { - payload['documents'] = documents; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - 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 all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {object} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. - */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {object} data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; - updateDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - data: rest[1] as object, - queries: rest[2] as string[], - transactionId: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const data = params.data; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - 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 - ); - } - - /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. - */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} documentId - Document 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 {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON 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 {string} transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} + * @returns {Promise<Document>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; + createDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string + documentId: rest[1] as string, + data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, + permissions: rest[3] as string[], + transactionId: rest[4] as string }; } const databaseId = params.databaseId; const collectionId = params.collectionId; - const queries = params.queries; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5366,11 +491,23 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv if (typeof collectionId === 'undefined') { throw new AppwriteException('Missing required parameter: "collectionId"'); } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; + if (typeof documentId !== 'undefined') { + payload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -5382,7 +519,7 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'delete', + 'post', uri, apiHeaders, payload @@ -5914,326 +1051,4 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv payload ); } - - /** - * List indexes in the collection. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} params.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: key, type, status, attributes, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IndexList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. - */ - listIndexes(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; - /** - * List indexes in the collection. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string[]} 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: key, type, status, attributes, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IndexList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIndexes(this: Databases<ServerAuth>, databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; - listIndexes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.IndexList> { - let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - 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 - ); - } - - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @param {DatabasesIndexType} params.type - Index type. - * @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} params.lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. - */ - createIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @param {DatabasesIndexType} type - Index type. - * @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; - createIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] - ): Promise<Models.Index> { - let params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - type: rest[2] as DatabasesIndexType, - attributes: rest[3] as string[], - orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const type = params.type; - const attributes = params.attributes; - const orders = params.orders; - const lengths = params.lengths; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof attributes === 'undefined') { - throw new AppwriteException('Missing required parameter: "attributes"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get an index by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. - */ - getIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; - /** - * Get an index by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<Models.Index>; - getIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Index> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - 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 index. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. - */ - deleteIndex(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; - /** - * Delete an index. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIndex(this: Databases<ServerAuth>, databaseId: string, collectionId: string, key: string): Promise<{}>; - deleteIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - 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 - ); - } } - -const Databases = DatabasesRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Databases<TAuth>; -}; - -export { Databases }; diff --git a/src/services/functions.ts b/src/services/functions.ts index ff6e7aa9..fc3f50ce 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1,1687 +1,41 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { Runtime } from '../enums/runtime'; -import { Scopes } from '../enums/scopes'; -import { TemplateReferenceType } from '../enums/template-reference-type'; -import { VCSReferenceType } from '../enums/vcs-reference-type'; -import { DeploymentDownloadType } from '../enums/deployment-download-type'; import { ExecutionMethod } from '../enums/execution-method'; -type FunctionsServerOnlyMethod = 'list' | 'create' | 'listRuntimes' | 'listSpecifications' | 'get' | 'update' | 'delete' | 'updateFunctionDeployment' | 'listDeployments' | 'createDeployment' | 'createDuplicateDeployment' | 'createTemplateDeployment' | 'createVcsDeployment' | 'getDeployment' | 'deleteDeployment' | 'getDeploymentDownload' | 'updateDeploymentStatus' | 'deleteExecution' | 'listVariables' | 'createVariable' | 'getVariable' | 'updateVariable' | 'deleteVariable'; -type FunctionsClientOnlyMethod = never; +export class Functions { + client: Client; -export type Functions<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsClientOnlyMethod> - : Omit<FunctionsRuntime<TAuth>, 'client'>; - -class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { - this.client = client; - } - - /** - * Get a list of all the project's functions. You can use the query params to filter your results. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FunctionList>} - */ - list(this: Functions<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; - /** - * Get a list of all the project's functions. You can use the query params to filter your results. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FunctionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(this: Functions<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.FunctionList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/functions'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. - * - * @param {string} params.functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Function name. Max length: 128 chars. - * @param {Runtime} params.runtime - Execution runtime. - * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.schedule - Schedule CRON syntax. - * @param {number} params.timeout - Function maximum execution time in seconds. - * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. - * @param {string} params.providerBranch - Production branch for the repo linked to the function. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to function code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the function deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the function executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - create(this: Functions<ServerAuth>, params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; - /** - * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. - * - * @param {string} functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Function name. Max length: 128 chars. - * @param {Runtime} runtime - Execution runtime. - * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} schedule - Schedule CRON syntax. - * @param {number} timeout - Function maximum execution time in seconds. - * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. - * @param {string} providerBranch - Production branch for the repo linked to the function. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to function code in the linked repo. - * @param {string} buildSpecification - Build specification for the function deployments. - * @param {string} runtimeSpecification - Runtime specification for the function executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(this: Functions<ServerAuth>, functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; - create( - paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - functionId: paramsOrFirst as string, - name: rest[0] as string, - runtime: rest[1] as Runtime, - execute: rest[2] as string[], - events: rest[3] as string[], - schedule: rest[4] as string, - timeout: rest[5] as number, - enabled: rest[6] as boolean, - logging: rest[7] as boolean, - entrypoint: rest[8] as string, - commands: rest[9] as string, - scopes: rest[10] as Scopes[], - installationId: rest[11] as string, - providerRepositoryId: rest[12] as string, - providerBranch: rest[13] as string, - providerSilentMode: rest[14] as boolean, - providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number - }; - } - - const functionId = params.functionId; - const name = params.name; - const runtime = params.runtime; - const execute = params.execute; - const events = params.events; - const schedule = params.schedule; - const timeout = params.timeout; - const enabled = params.enabled; - const logging = params.logging; - const entrypoint = params.entrypoint; - const commands = params.commands; - const scopes = params.scopes; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof runtime === 'undefined') { - throw new AppwriteException('Missing required parameter: "runtime"'); - } - - const apiPath = '/functions'; - const payload: Payload = {}; - if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all runtimes that are currently active on your instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.RuntimeList>} - */ - listRuntimes(this: Functions<ServerAuth>, ): Promise<Models.RuntimeList>; - listRuntimes(): Promise<Models.RuntimeList> { - - const apiPath = '/functions/runtimes'; - 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 - ); - } - - /** - * List allowed function specifications for this instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.SpecificationList>} - */ - listSpecifications(this: Functions<ServerAuth>, ): Promise<Models.SpecificationList>; - listSpecifications(): Promise<Models.SpecificationList> { - - const apiPath = '/functions/specifications'; - 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 - ); - } - - /** - * Get a function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - get(this: Functions<ServerAuth>, params: { functionId: string }): Promise<Models.Function>; - /** - * Get a function by its unique ID. - * - * @param {string} functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(this: Functions<ServerAuth>, functionId: string): Promise<Models.Function>; - get( - paramsOrFirst: { functionId: string } | string - ): Promise<Models.Function> { - let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string }; - } else { - params = { - functionId: paramsOrFirst as string - }; - } - - const functionId = params.functionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.name - Function name. Max length: 128 chars. - * @param {Runtime} params.runtime - Execution runtime. - * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.schedule - Schedule CRON syntax. - * @param {number} params.timeout - Maximum execution time in seconds. - * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function - * @param {string} params.providerBranch - Production branch for the repo linked to the function - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to function code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the function deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the function executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - update(this: Functions<ServerAuth>, params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; - /** - * Update function by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} name - Function name. Max length: 128 chars. - * @param {Runtime} runtime - Execution runtime. - * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} schedule - Schedule CRON syntax. - * @param {number} timeout - Maximum execution time in seconds. - * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the function - * @param {string} providerBranch - Production branch for the repo linked to the function - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to function code in the linked repo. - * @param {string} buildSpecification - Build specification for the function deployments. - * @param {string} runtimeSpecification - Runtime specification for the function executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(this: Functions<ServerAuth>, functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; - update( - paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - functionId: paramsOrFirst as string, - name: rest[0] as string, - runtime: rest[1] as Runtime, - execute: rest[2] as string[], - events: rest[3] as string[], - schedule: rest[4] as string, - timeout: rest[5] as number, - enabled: rest[6] as boolean, - logging: rest[7] as boolean, - entrypoint: rest[8] as string, - commands: rest[9] as string, - scopes: rest[10] as Scopes[], - installationId: rest[11] as string, - providerRepositoryId: rest[12] as string, - providerBranch: rest[13] as string, - providerSilentMode: rest[14] as boolean, - providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number - }; - } - - const functionId = params.functionId; - const name = params.name; - const runtime = params.runtime; - const execute = params.execute; - const events = params.events; - const schedule = params.schedule; - const timeout = params.timeout; - const enabled = params.enabled; - const logging = params.logging; - const entrypoint = params.entrypoint; - const commands = params.commands; - const scopes = params.scopes; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(this: Functions<ServerAuth>, params: { functionId: string }): Promise<{}>; - /** - * Delete a function by its unique ID. - * - * @param {string} functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(this: Functions<ServerAuth>, functionId: string): Promise<{}>; - delete( - paramsOrFirst: { functionId: string } | string - ): Promise<{}> { - let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string }; - } else { - params = { - functionId: paramsOrFirst as string - }; - } - - const functionId = params.functionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - updateFunctionDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Function>; - /** - * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFunctionDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Function>; - updateFunctionDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Function> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all the function's code deployments. You can use the query params to filter your results. - * - * @param {string} params.functionId - Function 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - */ - listDeployments(this: Functions<ServerAuth>, params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; - /** - * Get a list of all the function's code deployments. You can use the query params to filter your results. - * - * @param {string} functionId - Function 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDeployments(this: Functions<ServerAuth>, functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; - listDeployments( - paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.DeploymentList> { - let params: { functionId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const functionId = params.functionId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - * - * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - * - * Use the "command" param to set the entrypoint used to execute your code. - * - * @param {string} params.functionId - Function ID. - * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @param {string} params.entrypoint - Entrypoint File. - * @param {string} params.commands - Build Commands. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDeployment(this: Functions<ServerAuth>, params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; - /** - * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - * - * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - * - * Use the "command" param to set the entrypoint used to execute your code. - * - * @param {string} functionId - Function ID. - * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @param {string} entrypoint - Entrypoint File. - * @param {string} commands - Build Commands. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDeployment(this: Functions<ServerAuth>, functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - functionId: paramsOrFirst as string, - code: rest[0] as File, - activate: rest[1] as boolean, - entrypoint: rest[2] as string, - commands: rest[3] as string - }; - onProgress = rest[4] as ((progress: UploadProgress) => void); - } - - const functionId = params.functionId; - const code = params.code; - const activate = params.activate; - const entrypoint = params.entrypoint; - const commands = params.commands; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof code !== 'undefined') { - payload['code'] = code; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', - } - - return this.client.chunkedUpload( - 'post', - uri, - apiHeaders, - payload, - onProgress - ); - } - - /** - * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {string} params.buildId - Build unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDuplicateDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; - /** - * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @param {string} buildId - Build unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDuplicateDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; - createDuplicateDeployment( - paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string, buildId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, buildId?: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string, - buildId: rest[1] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - const buildId = params.buildId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - if (typeof buildId !== 'undefined') { - payload['buildId'] = buildId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.repository - Repository name of the template. - * @param {string} params.owner - The name of the owner of the template. - * @param {string} params.rootDirectory - Path to function code in the template repo. - * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createTemplateDeployment(this: Functions<ServerAuth>, params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. - * - * @param {string} functionId - Function ID. - * @param {string} repository - Repository name of the template. - * @param {string} owner - The name of the owner of the template. - * @param {string} rootDirectory - Path to function code in the template repo. - * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTemplateDeployment(this: Functions<ServerAuth>, functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createTemplateDeployment( - paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - repository: rest[0] as string, - owner: rest[1] as string, - rootDirectory: rest[2] as string, - type: rest[3] as TemplateReferenceType, - reference: rest[4] as string, - activate: rest[5] as boolean - }; - } - - const functionId = params.functionId; - const repository = params.repository; - const owner = params.owner; - const rootDirectory = params.rootDirectory; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof repository === 'undefined') { - throw new AppwriteException('Missing required parameter: "repository"'); - } - if (typeof owner === 'undefined') { - throw new AppwriteException('Missing required parameter: "owner"'); - } - if (typeof rootDirectory === 'undefined') { - throw new AppwriteException('Missing required parameter: "rootDirectory"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof repository !== 'undefined') { - payload['repository'] = repository; - } - if (typeof owner !== 'undefined') { - payload['owner'] = owner; - } - if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a deployment when a function is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} params.functionId - Function ID. - * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit - * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createVcsDeployment(this: Functions<ServerAuth>, params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment when a function is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} functionId - Function ID. - * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit - * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVcsDeployment(this: Functions<ServerAuth>, functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createVcsDeployment( - paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - type: rest[0] as VCSReferenceType, - reference: rest[1] as string, - activate: rest[2] as boolean - }; - } - - const functionId = params.functionId; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a function deployment by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - getDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Get a function deployment by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Deployment>; - getDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - 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 code deployment by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteDeployment(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<{}>; - /** - * Delete a code deployment by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDeployment(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<{}>; - deleteDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {string} - */ - getDeploymentDownload(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; - /** - * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {string} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeploymentDownload(this: Functions<ServerAuth>, functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; - getDeploymentDownload( - paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] - ): string { - let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - const type = params.type; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; - - for (const [key, value] of Object.entries(Service.flatten(payload))) { - uri.searchParams.append(key, value); - } - - return uri.toString(); - } - - /** - * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - updateDeploymentStatus(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDeploymentStatus(this: Functions<ServerAuth>, functionId: string, deploymentId: string): Promise<Models.Deployment>; - updateDeploymentStatus( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - 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( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. - * - * @param {string} params.functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; - /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. - * - * @param {string} functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listExecutions( - paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { - let params: { functionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const functionId = params.functionId; - const queries = params.queries; - const total = params.total; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - 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 - ); - } - - /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.body - HTTP body of execution. Default value is empty string. - * @param {boolean} params.async - Execute code in the background. Default value is false. - * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. - * @param {object} params.headers - HTTP headers of execution. Defaults to empty. - * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; - /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. - * - * @param {string} functionId - Function ID. - * @param {string} body - HTTP body of execution. Default value is empty string. - * @param {boolean} async - Execute code in the background. Default value is false. - * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. - * @param {object} headers - HTTP headers of execution. Defaults to empty. - * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; - createExecution( - paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; - } else { - params = { - functionId: paramsOrFirst as string, - body: rest[0] as string, - async: rest[1] as boolean, - xpath: rest[2] as string, - method: rest[3] as ExecutionMethod, - headers: rest[4] as object, - scheduledAt: rest[5] as string - }; - } - - const functionId = params.functionId; - const body = params.body; - const async = params.async; - const xpath = params.xpath; - const method = params.method; - const headers = params.headers; - const scheduledAt = params.scheduledAt; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof async !== 'undefined') { - payload['async'] = async; - } - if (typeof xpath !== 'undefined') { - payload['path'] = xpath; - } - if (typeof method !== 'undefined') { - payload['method'] = method; - } - if (typeof headers !== 'undefined') { - payload['headers'] = headers; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a function execution log by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; - /** - * Get a function execution log by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getExecution(functionId: string, executionId: string): Promise<Models.Execution>; - getExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, executionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - executionId: rest[0] as string - }; - } - - const functionId = params.functionId; - const executionId = params.executionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - 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 - ); + constructor(client: Client) { + this.client = client; } /** - * Delete a function execution by its unique ID. + * Get a list of all the current user function execution logs. You can use the query params to filter your results. * * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteExecution(this: Functions<ServerAuth>, params: { functionId: string, executionId: string }): Promise<{}>; - /** - * Delete a function execution by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteExecution(this: Functions<ServerAuth>, functionId: string, executionId: string): Promise<{}>; - deleteExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, executionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - executionId: rest[0] as string - }; - } - - const functionId = params.functionId; - const executionId = params.executionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all variables of a specific function. - * - * @param {string} params.functionId - Function unique ID. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} + * @returns {Promise<Models.ExecutionList>} */ - listVariables(this: Functions<ServerAuth>, params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; /** - * Get a list of all variables of a specific function. + * Get a list of all the current user function execution logs. You can use the query params to filter your results. * - * @param {string} functionId - Function unique ID. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {string} functionId - Function 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} + * @returns {Promise<Models.ExecutionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(this: Functions<ServerAuth>, functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( + listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listExecutions( paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] - ): Promise<Models.VariableList> { + ): Promise<Models.ExecutionList> { let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -1702,7 +56,7 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1724,220 +78,85 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable 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.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable 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} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(this: Functions<ServerAuth>, functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const functionId = params.functionId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a variable by its unique ID. + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. + * @param {string} params.functionId - Function ID. + * @param {string} params.body - HTTP body of execution. Default value is empty string. + * @param {boolean} params.async - Execute code in the background. Default value is false. + * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. + * @param {object} params.headers - HTTP headers of execution. Defaults to empty. + * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} + * @returns {Promise<Models.Execution>} */ - getVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<Models.Variable>; + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; /** - * Get a variable by its unique ID. + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. + * @param {string} functionId - Function ID. + * @param {string} body - HTTP body of execution. Default value is empty string. + * @param {boolean} async - Execute code in the background. Default value is false. + * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. + * @param {object} headers - HTTP headers of execution. Defaults to empty. + * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} + * @returns {Promise<Models.Execution>} * @deprecated Use the object parameter style method for a better developer experience. */ - getVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string }; + createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; + createExecution( + paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] + ): Promise<Models.Execution> { + let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; } else { params = { functionId: paramsOrFirst as string, - variableId: rest[0] as string + body: rest[0] as string, + async: rest[1] as boolean, + xpath: rest[2] as string, + method: rest[3] as ExecutionMethod, + headers: rest[4] as object, + scheduledAt: rest[5] as string }; } const functionId = params.functionId; - const variableId = params.variableId; + const body = params.body; + const async = params.async; + const xpath = params.xpath; + const method = params.method; + const headers = params.headers; + const scheduledAt = params.scheduledAt; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(this: Functions<ServerAuth>, functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; + if (typeof body !== 'undefined') { + payload['body'] = body; } - - const functionId = params.functionId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + if (typeof async !== 'undefined') { + payload['async'] = async; } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + if (typeof xpath !== 'undefined') { + payload['path'] = xpath; } - - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; + if (typeof method !== 'undefined') { + payload['method'] = method; } - if (typeof value !== 'undefined') { - payload['value'] = value; + if (typeof headers !== 'undefined') { + payload['headers'] = headers; } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -1946,7 +165,7 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'put', + 'post', uri, apiHeaders, payload @@ -1954,68 +173,61 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Delete a variable by its unique ID. + * Get a function execution log by its unique ID. * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. + * @param {string} params.functionId - Function ID. + * @param {string} params.executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<Models.Execution>} */ - deleteVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<{}>; + getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; /** - * Delete a variable by its unique ID. + * Get a function execution log by its unique ID. * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. + * @param {string} functionId - Function ID. + * @param {string} executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<Models.Execution>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, + getExecution(functionId: string, executionId: string): Promise<Models.Execution>; + getExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, variableId: string }; + ): Promise<Models.Execution> { + let params: { functionId: string, executionId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; } else { params = { functionId: paramsOrFirst as string, - variableId: rest[0] as string + executionId: rest[0] as string }; } const functionId = params.functionId; - const variableId = params.variableId; + const executionId = params.executionId; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); 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', + 'get', uri, apiHeaders, payload ); } } - -const Functions = FunctionsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Functions<TAuth>; -}; - -export { Functions }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 5068c21d..e995f66e 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type GraphqlServerOnlyMethod = never; -type GraphqlClientOnlyMethod = never; +export class Graphql { + client: Client; -export type Graphql<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlClientOnlyMethod> - : Omit<GraphqlRuntime<TAuth>, 'client'>; - -class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -131,9 +122,3 @@ class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } } - -const Graphql = GraphqlRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Graphql<TAuth>; -}; - -export { Graphql }; diff --git a/src/services/health.ts b/src/services/health.ts deleted file mode 100644 index 32578a39..00000000 --- a/src/services/health.ts +++ /dev/null @@ -1,1050 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { Name } from '../enums/name'; - -export type Health = Omit<HealthRuntime, 'client'>; - -class HealthRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Check the Appwrite HTTP server is up and responsive. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - get(): Promise<Models.HealthStatus> { - - const apiPath = '/health'; - 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 - ); - } - - /** - * Check the Appwrite Antivirus server is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthAntivirus>} - */ - getAntivirus(): Promise<Models.HealthAntivirus> { - - const apiPath = '/health/anti-virus'; - 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 - ); - } - - /** - * Check the Appwrite in-memory cache servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getCache(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/cache'; - 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 - ); - } - - /** - * Get the SSL certificate for a domain - * - * @param {string} params.domain - string - * @throws {AppwriteException} - * @returns {Promise<Models.HealthCertificate>} - */ - getCertificate(params?: { domain?: string }): Promise<Models.HealthCertificate>; - /** - * Get the SSL certificate for a domain - * - * @param {string} domain - string - * @throws {AppwriteException} - * @returns {Promise<Models.HealthCertificate>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCertificate(domain?: string): Promise<Models.HealthCertificate>; - getCertificate( - paramsOrFirst?: { domain?: string } | string - ): Promise<Models.HealthCertificate> { - let params: { domain?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain?: string }; - } else { - params = { - domain: paramsOrFirst as string - }; - } - - const domain = params.domain; - - - const apiPath = '/health/certificate'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. - * - * - * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. - * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise<Models.HealthStatus>; - /** - * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. - * - * - * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. - * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getConsolePausing(threshold?: number, inactivityDays?: number): Promise<Models.HealthStatus>; - getConsolePausing( - paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, - ...rest: [(number)?] - ): Promise<Models.HealthStatus> { - let params: { threshold?: number, inactivityDays?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; - } else { - params = { - threshold: paramsOrFirst as number, - inactivityDays: rest[0] as number - }; - } - - const threshold = params.threshold; - const inactivityDays = params.inactivityDays; - - - const apiPath = '/health/console-pausing'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - if (typeof inactivityDays !== 'undefined') { - payload['inactivityDays'] = inactivityDays; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Check the Appwrite database servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getDB(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/db'; - 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 - ); - } - - /** - * Check the Appwrite pub-sub servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getPubSub(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/pubsub'; - 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 - ); - } - - /** - * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. - * - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueAudits(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. - * - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueAudits(threshold?: number): Promise<Models.HealthQueue>; - getQueueAudits( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/audits'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueBuilds(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>; - getQueueBuilds( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/builds'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueCertificates(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>; - getQueueCertificates( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/certificates'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {string} params.name - Queue name for which to check the queue size - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueDatabases(params?: { name?: string, threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {string} name - Queue name for which to check the queue size - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>; - getQueueDatabases( - paramsOrFirst?: { name?: string, threshold?: number } | string, - ...rest: [(number)?] - ): Promise<Models.HealthQueue> { - let params: { name?: string, threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name?: string, threshold?: number }; - } else { - params = { - name: paramsOrFirst as string, - threshold: rest[0] as number - }; - } - - const name = params.name; - const threshold = params.threshold; - - - const apiPath = '/health/queue/databases'; - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueDeletes(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>; - getQueueDeletes( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/deletes'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {Name} params.name - The name of the queue - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getFailedJobs(params: { name: Name, threshold?: number }): Promise<Models.HealthQueue>; - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {Name} name - The name of the queue - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>; - getFailedJobs( - paramsOrFirst: { name: Name, threshold?: number } | Name, - ...rest: [(number)?] - ): Promise<Models.HealthQueue> { - let params: { name: Name, threshold?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name: Name, threshold?: number }; - } else { - params = { - name: paramsOrFirst as Name, - threshold: rest[0] as number - }; - } - - const name = params.name; - const threshold = params.threshold; - - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/health/queue/failed/{name}'.replace('{name}', name); - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueFunctions(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>; - getQueueFunctions( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/functions'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueLogs(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueLogs(threshold?: number): Promise<Models.HealthQueue>; - getQueueLogs( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/logs'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMails(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMails(threshold?: number): Promise<Models.HealthQueue>; - getQueueMails( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/mails'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMessaging(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>; - getQueueMessaging( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/messaging'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMigrations(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>; - getQueueMigrations( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/migrations'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueStatsResources(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>; - getQueueStatsResources( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/stats-resources'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueUsage(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueUsage(threshold?: number): Promise<Models.HealthQueue>; - getQueueUsage( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/stats-usage'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueWebhooks(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>; - getQueueWebhooks( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/webhooks'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Check the Appwrite storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getStorage(): Promise<Models.HealthStatus> { - - const apiPath = '/health/storage'; - 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 - ); - } - - /** - * Check the Appwrite local storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getStorageLocal(): Promise<Models.HealthStatus> { - - const apiPath = '/health/storage/local'; - 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 - ); - } - - /** - * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthTime>} - */ - getTime(): Promise<Models.HealthTime> { - - const apiPath = '/health/time'; - 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 - ); - } -} - -const Health = HealthRuntime as unknown as { - new (client: Client<ServerAuth>): Health; -}; - -export { Health }; diff --git a/src/services/locale.ts b/src/services/locale.ts index c9a0b95f..fe85eeb5 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type LocaleServerOnlyMethod = never; -type LocaleClientOnlyMethod = never; +export class Locale { + client: Client; -export type Locale<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleClientOnlyMethod> - : Omit<LocaleRuntime<TAuth>, 'client'>; - -class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -205,9 +196,3 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA ); } } - -const Locale = LocaleRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Locale<TAuth>; -}; - -export { Locale }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 35acc289..d6c45bcd 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -1,5010 +1,13 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { MessagePriority } from '../enums/message-priority'; -import { SmtpEncryption } from '../enums/smtp-encryption'; -type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'createSMS' | 'updateSms' | 'updateSMS' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'createAPNSProvider' | 'updateApnsProvider' | 'updateAPNSProvider' | 'createFcmProvider' | 'createFCMProvider' | 'updateFcmProvider' | 'updateFCMProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'createSMTPProvider' | 'updateSmtpProvider' | 'updateSMTPProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; -type MessagingClientOnlyMethod = never; +export class Messaging { + client: Client; -export type Messaging<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingClientOnlyMethod> - : Omit<MessagingRuntime<TAuth>, 'client'>; - -class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { - this.client = client; - } - - /** - * Get a list of all messages from the current Appwrite project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MessageList>} - */ - listMessages(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; - /** - * Get a list of all messages from the current Appwrite project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MessageList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMessages(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; - listMessages( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.MessageList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/messages'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new email message. - * - * @param {string} params.messageId - Message 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.subject - Email Subject. - * @param {string} params.content - Email Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string[]} params.cc - Array of target IDs to be added as CC. - * @param {string[]} params.bcc - Array of target IDs to be added as BCC. - * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {boolean} params.draft - Is message a draft - * @param {boolean} params.html - Is content of type HTML - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createEmail(this: Messaging<ServerAuth>, params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new email message. - * - * @param {string} messageId - Message 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} subject - Email Subject. - * @param {string} content - Email Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string[]} cc - Array of target IDs to be added as CC. - * @param {string[]} bcc - Array of target IDs to be added as BCC. - * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {boolean} draft - Is message a draft - * @param {boolean} html - Is content of type HTML - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmail(this: Messaging<ServerAuth>, messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; - createEmail( - paramsOrFirst: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - subject: rest[0] as string, - content: rest[1] as string, - topics: rest[2] as string[], - users: rest[3] as string[], - targets: rest[4] as string[], - cc: rest[5] as string[], - bcc: rest[6] as string[], - attachments: rest[7] as string[], - draft: rest[8] as boolean, - html: rest[9] as boolean, - scheduledAt: rest[10] as string - }; - } - - const messageId = params.messageId; - const subject = params.subject; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const cc = params.cc; - const bcc = params.bcc; - const attachments = params.attachments; - const draft = params.draft; - const html = params.html; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof subject === 'undefined') { - throw new AppwriteException('Missing required parameter: "subject"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/email'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof cc !== 'undefined') { - payload['cc'] = cc; - } - if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; - } - if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof html !== 'undefined') { - payload['html'] = html; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.subject - Email Subject. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {boolean} params.html - Is content of type HTML - * @param {string[]} params.cc - Array of target IDs to be added as CC. - * @param {string[]} params.bcc - Array of target IDs to be added as BCC. - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updateEmail(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; - /** - * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} subject - Email Subject. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {boolean} html - Is content of type HTML - * @param {string[]} cc - Array of target IDs to be added as CC. - * @param {string[]} bcc - Array of target IDs to be added as BCC. - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmail(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; - updateEmail( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (boolean)?, (string[])?, (string[])?, (string)?, (string[])?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - subject: rest[3] as string, - content: rest[4] as string, - draft: rest[5] as boolean, - html: rest[6] as boolean, - cc: rest[7] as string[], - bcc: rest[8] as string[], - scheduledAt: rest[9] as string, - attachments: rest[10] as string[] - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const subject = params.subject; - const content = params.content; - const draft = params.draft; - const html = params.html; - const cc = params.cc; - const bcc = params.bcc; - const scheduledAt = params.scheduledAt; - const attachments = params.attachments; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof html !== 'undefined') { - payload['html'] = html; - } - if (typeof cc !== 'undefined') { - payload['cc'] = cc; - } - if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new push notification. - * - * @param {string} params.messageId - Message 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.title - Title for push notification. - * @param {string} params.body - Body for push notification. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {object} params.data - Additional key-value pair data for push notification. - * @param {string} params.action - Action for push notification. - * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} params.icon - Icon for push notification. Available only for Android and Web Platform. - * @param {string} params.sound - Sound for push notification. Available only for Android and iOS Platform. - * @param {string} params.color - Color for push notification. Available only for Android Platform. - * @param {string} params.tag - Tag for push notification. Available only for Android Platform. - * @param {number} params.badge - Badge for push notification. Available only for iOS Platform. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createPush(this: Messaging<ServerAuth>, params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; - /** - * Create a new push notification. - * - * @param {string} messageId - Message 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} title - Title for push notification. - * @param {string} body - Body for push notification. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {object} data - Additional key-value pair data for push notification. - * @param {string} action - Action for push notification. - * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} icon - Icon for push notification. Available only for Android and Web Platform. - * @param {string} sound - Sound for push notification. Available only for Android and iOS Platform. - * @param {string} color - Color for push notification. Available only for Android Platform. - * @param {string} tag - Tag for push notification. Available only for Android Platform. - * @param {number} badge - Badge for push notification. Available only for iOS Platform. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPush(this: Messaging<ServerAuth>, messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; - createPush( - paramsOrFirst: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, - ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] - ): Promise<Models.Message> { - let params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - } else { - params = { - messageId: paramsOrFirst as string, - title: rest[0] as string, - body: rest[1] as string, - topics: rest[2] as string[], - users: rest[3] as string[], - targets: rest[4] as string[], - data: rest[5] as object, - action: rest[6] as string, - image: rest[7] as string, - icon: rest[8] as string, - sound: rest[9] as string, - color: rest[10] as string, - tag: rest[11] as string, - badge: rest[12] as number, - draft: rest[13] as boolean, - scheduledAt: rest[14] as string, - contentAvailable: rest[15] as boolean, - critical: rest[16] as boolean, - priority: rest[17] as MessagePriority - }; - } - - const messageId = params.messageId; - const title = params.title; - const body = params.body; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const data = params.data; - const action = params.action; - const image = params.image; - const icon = params.icon; - const sound = params.sound; - const color = params.color; - const tag = params.tag; - const badge = params.badge; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - const contentAvailable = params.contentAvailable; - const critical = params.critical; - const priority = params.priority; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/push'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof title !== 'undefined') { - payload['title'] = title; - } - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof action !== 'undefined') { - payload['action'] = action; - } - if (typeof image !== 'undefined') { - payload['image'] = image; - } - if (typeof icon !== 'undefined') { - payload['icon'] = icon; - } - if (typeof sound !== 'undefined') { - payload['sound'] = sound; - } - if (typeof color !== 'undefined') { - payload['color'] = color; - } - if (typeof tag !== 'undefined') { - payload['tag'] = tag; - } - if (typeof badge !== 'undefined') { - payload['badge'] = badge; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; - } - if (typeof critical !== 'undefined') { - payload['critical'] = critical; - } - if (typeof priority !== 'undefined') { - payload['priority'] = priority; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.title - Title for push notification. - * @param {string} params.body - Body for push notification. - * @param {object} params.data - Additional Data for push notification. - * @param {string} params.action - Action for push notification. - * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} params.icon - Icon for push notification. Available only for Android and Web platforms. - * @param {string} params.sound - Sound for push notification. Available only for Android and iOS platforms. - * @param {string} params.color - Color for push notification. Available only for Android platforms. - * @param {string} params.tag - Tag for push notification. Available only for Android platforms. - * @param {number} params.badge - Badge for push notification. Available only for iOS platforms. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updatePush(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; - /** - * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} title - Title for push notification. - * @param {string} body - Body for push notification. - * @param {object} data - Additional Data for push notification. - * @param {string} action - Action for push notification. - * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} icon - Icon for push notification. Available only for Android and Web platforms. - * @param {string} sound - Sound for push notification. Available only for Android and iOS platforms. - * @param {string} color - Color for push notification. Available only for Android platforms. - * @param {string} tag - Tag for push notification. Available only for Android platforms. - * @param {number} badge - Badge for push notification. Available only for iOS platforms. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePush(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; - updatePush( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - title: rest[3] as string, - body: rest[4] as string, - data: rest[5] as object, - action: rest[6] as string, - image: rest[7] as string, - icon: rest[8] as string, - sound: rest[9] as string, - color: rest[10] as string, - tag: rest[11] as string, - badge: rest[12] as number, - draft: rest[13] as boolean, - scheduledAt: rest[14] as string, - contentAvailable: rest[15] as boolean, - critical: rest[16] as boolean, - priority: rest[17] as MessagePriority - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const title = params.title; - const body = params.body; - const data = params.data; - const action = params.action; - const image = params.image; - const icon = params.icon; - const sound = params.sound; - const color = params.color; - const tag = params.tag; - const badge = params.badge; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - const contentAvailable = params.contentAvailable; - const critical = params.critical; - const priority = params.priority; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof title !== 'undefined') { - payload['title'] = title; - } - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof action !== 'undefined') { - payload['action'] = action; - } - if (typeof image !== 'undefined') { - payload['image'] = image; - } - if (typeof icon !== 'undefined') { - payload['icon'] = icon; - } - if (typeof sound !== 'undefined') { - payload['sound'] = sound; - } - if (typeof color !== 'undefined') { - payload['color'] = color; - } - if (typeof tag !== 'undefined') { - payload['tag'] = tag; - } - if (typeof badge !== 'undefined') { - payload['badge'] = badge; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; - } - if (typeof critical !== 'undefined') { - payload['critical'] = critical; - } - if (typeof priority !== 'undefined') { - payload['priority'] = priority; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new SMS message. - * - * @param {string} params.messageId - Message 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.content - SMS Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. - */ - createSms(this: Messaging<ServerAuth>, params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new SMS message. - * - * @param {string} messageId - Message 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} content - SMS Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSms(this: Messaging<ServerAuth>, messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - createSms( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - content: rest[0] as string, - topics: rest[1] as string[], - users: rest[2] as string[], - targets: rest[3] as string[], - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new SMS message. - * - * @param {string} params.messageId - Message 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.content - SMS Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createSMS(this: Messaging<ServerAuth>, params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new SMS message. - * - * @param {string} messageId - Message 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} content - SMS Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMS(this: Messaging<ServerAuth>, messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - createSMS( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - content: rest[0] as string, - topics: rest[1] as string[], - users: rest[2] as string[], - targets: rest[3] as string[], - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. - */ - updateSms(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSms(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - updateSms( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const content = params.content; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updateSMS(this: Messaging<ServerAuth>, params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSMS(this: Messaging<ServerAuth>, messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - updateSMS( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const content = params.content; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a message by its unique ID. - * - * - * @param {string} params.messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - getMessage(this: Messaging<ServerAuth>, params: { messageId: string }): Promise<Models.Message>; - /** - * Get a message by its unique ID. - * - * - * @param {string} messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMessage(this: Messaging<ServerAuth>, messageId: string): Promise<Models.Message>; - getMessage( - paramsOrFirst: { messageId: string } | string - ): Promise<Models.Message> { - let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string }; - } else { - params = { - messageId: paramsOrFirst as string - }; - } - - const messageId = params.messageId; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); - 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 message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. - * - * @param {string} params.messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(this: Messaging<ServerAuth>, params: { messageId: string }): Promise<{}>; - /** - * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. - * - * @param {string} messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(this: Messaging<ServerAuth>, messageId: string): Promise<{}>; - delete( - paramsOrFirst: { messageId: string } | string - ): Promise<{}> { - let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string }; - } else { - params = { - messageId: paramsOrFirst as string - }; - } - - const messageId = params.messageId; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the message activity logs listed by its unique ID. - * - * @param {string} params.messageId - Message 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). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listMessageLogs(this: Messaging<ServerAuth>, params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the message activity logs listed by its unique ID. - * - * @param {string} messageId - Message 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). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMessageLogs(this: Messaging<ServerAuth>, messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listMessageLogs( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { messageId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; - } else { - params = { - messageId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const messageId = params.messageId; - const queries = params.queries; - const total = params.total; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}/logs'.replace('{messageId}', messageId); - 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 a list of the targets associated with a message. - * - * @param {string} params.messageId - Message 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: userId, providerId, identifier, providerType - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - */ - listTargets(this: Messaging<ServerAuth>, params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; - /** - * Get a list of the targets associated with a message. - * - * @param {string} messageId - Message 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: userId, providerId, identifier, providerType - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTargets(this: Messaging<ServerAuth>, messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; - listTargets( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.TargetList> { - let params: { messageId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; - } else { - params = { - messageId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const messageId = params.messageId; - const queries = params.queries; - const total = params.total; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', messageId); - 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 a list of all providers from the current Appwrite project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProviderList>} - */ - listProviders(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; - /** - * Get a list of all providers from the current Appwrite project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProviderList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listProviders(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; - listProviders( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.ProviderList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/providers'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. - */ - createApnsProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createApnsProvider(this: Messaging<ServerAuth>, providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; - createApnsProvider( - paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - authKey: rest[1] as string, - authKeyId: rest[2] as string, - teamId: rest[3] as string, - bundleId: rest[4] as string, - sandbox: rest[5] as boolean, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/apns'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createAPNSProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAPNSProvider(this: Messaging<ServerAuth>, providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; - createAPNSProvider( - paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - authKey: rest[1] as string, - authKeyId: rest[2] as string, - teamId: rest[3] as string, - bundleId: rest[4] as string, - sandbox: rest[5] as boolean, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/apns'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. - */ - updateApnsProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApnsProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; - updateApnsProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - authKey: rest[2] as string, - authKeyId: rest[3] as string, - teamId: rest[4] as string, - bundleId: rest[5] as string, - sandbox: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateAPNSProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAPNSProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; - updateAPNSProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - authKey: rest[2] as string, - authKeyId: rest[3] as string, - teamId: rest[4] as string, - bundleId: rest[5] as string, - sandbox: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. - */ - createFcmProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFcmProvider(this: Messaging<ServerAuth>, providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; - createFcmProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - serviceAccountJSON: rest[1] as object, - enabled: rest[2] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const serviceAccountJSON = params.serviceAccountJSON; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/fcm'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createFCMProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFCMProvider(this: Messaging<ServerAuth>, providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; - createFCMProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - serviceAccountJSON: rest[1] as object, - enabled: rest[2] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const serviceAccountJSON = params.serviceAccountJSON; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/fcm'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. - */ - updateFcmProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFcmProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; - updateFcmProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - serviceAccountJSON: rest[2] as object - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const serviceAccountJSON = params.serviceAccountJSON; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateFCMProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFCMProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; - updateFCMProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - serviceAccountJSON: rest[2] as object - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const serviceAccountJSON = params.serviceAccountJSON; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Mailgun provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Mailgun API Key. - * @param {string} params.domain - Mailgun Domain. - * @param {boolean} params.isEuRegion - Set as EU region. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createMailgunProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Mailgun provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} apiKey - Mailgun API Key. - * @param {string} domain - Mailgun Domain. - * @param {boolean} isEuRegion - Set as EU region. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMailgunProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createMailgunProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - domain: rest[2] as string, - isEuRegion: rest[3] as boolean, - fromName: rest[4] as string, - fromEmail: rest[5] as string, - replyToName: rest[6] as string, - replyToEmail: rest[7] as string, - enabled: rest[8] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const domain = params.domain; - const isEuRegion = params.isEuRegion; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/mailgun'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Mailgun provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Mailgun API Key. - * @param {string} params.domain - Mailgun Domain. - * @param {boolean} params.isEuRegion - Set as EU region. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateMailgunProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Mailgun provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} apiKey - Mailgun API Key. - * @param {string} domain - Mailgun Domain. - * @param {boolean} isEuRegion - Set as EU region. - * @param {boolean} enabled - Set as enabled. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMailgunProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateMailgunProvider( - paramsOrFirst: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - domain: rest[2] as string, - isEuRegion: rest[3] as boolean, - enabled: rest[4] as boolean, - fromName: rest[5] as string, - fromEmail: rest[6] as string, - replyToName: rest[7] as string, - replyToEmail: rest[8] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const domain = params.domain; - const isEuRegion = params.isEuRegion; - const enabled = params.enabled; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new MSG91 provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.templateId - Msg91 template ID - * @param {string} params.senderId - Msg91 sender ID. - * @param {string} params.authKey - Msg91 auth key. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createMsg91Provider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new MSG91 provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} templateId - Msg91 template ID - * @param {string} senderId - Msg91 sender ID. - * @param {string} authKey - Msg91 auth key. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMsg91Provider(this: Messaging<ServerAuth>, providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; - createMsg91Provider( - paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - templateId: rest[1] as string, - senderId: rest[2] as string, - authKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const templateId = params.templateId; - const senderId = params.senderId; - const authKey = params.authKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/msg91'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a MSG91 provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.templateId - Msg91 template ID. - * @param {string} params.senderId - Msg91 sender ID. - * @param {string} params.authKey - Msg91 auth key. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateMsg91Provider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; - /** - * Update a MSG91 provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} templateId - Msg91 template ID. - * @param {string} senderId - Msg91 sender ID. - * @param {string} authKey - Msg91 auth key. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMsg91Provider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; - updateMsg91Provider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - templateId: rest[2] as string, - senderId: rest[3] as string, - authKey: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const templateId = params.templateId; - const senderId = params.senderId; - const authKey = params.authKey; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Resend provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Resend API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createResendProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Resend provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} apiKey - Resend API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createResendProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createResendProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - fromName: rest[2] as string, - fromEmail: rest[3] as string, - replyToName: rest[4] as string, - replyToEmail: rest[5] as string, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/resend'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Resend provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Resend API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateResendProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Resend provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Resend API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateResendProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateResendProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - fromName: rest[3] as string, - fromEmail: rest[4] as string, - replyToName: rest[5] as string, - replyToEmail: rest[6] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Sendgrid provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Sendgrid API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Sendgrid provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} apiKey - Sendgrid API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSendgridProvider(this: Messaging<ServerAuth>, providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSendgridProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - fromName: rest[2] as string, - fromEmail: rest[3] as string, - replyToName: rest[4] as string, - replyToEmail: rest[5] as string, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/sendgrid'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Sendgrid provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Sendgrid API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Sendgrid provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Sendgrid API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSendgridProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateSendgridProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - fromName: rest[3] as string, - fromEmail: rest[4] as string, - replyToName: rest[5] as string, - replyToEmail: rest[6] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new SMTP provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - The default SMTP server port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. - */ - createSmtpProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new SMTP provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - The default SMTP server port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSmtpProvider(this: Messaging<ServerAuth>, providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSmtpProvider( - paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof host === 'undefined') { - throw new AppwriteException('Missing required parameter: "host"'); - } - - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new SMTP provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - The default SMTP server port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createSMTPProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new SMTP provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - The default SMTP server port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMTPProvider(this: Messaging<ServerAuth>, providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSMTPProvider( - paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof host === 'undefined') { - throw new AppwriteException('Missing required parameter: "host"'); - } - - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - SMTP port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. - */ - updateSmtpProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - SMTP port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSmtpProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - updateSmtpProvider( - paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - SMTP port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateSMTPProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - SMTP port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSMTPProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - updateSMTPProvider( - paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Telesign provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.customerId - Telesign customer ID. - * @param {string} params.apiKey - Telesign API key. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTelesignProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Telesign provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} customerId - Telesign customer ID. - * @param {string} apiKey - Telesign API key. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTelesignProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; - createTelesignProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - customerId: rest[2] as string, - apiKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const customerId = params.customerId; - const apiKey = params.apiKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/telesign'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Telesign provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.customerId - Telesign customer ID. - * @param {string} params.apiKey - Telesign API key. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTelesignProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Telesign provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} customerId - Telesign customer ID. - * @param {string} apiKey - Telesign API key. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTelesignProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; - updateTelesignProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - customerId: rest[2] as string, - apiKey: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const customerId = params.customerId; - const apiKey = params.apiKey; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Textmagic provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.username - Textmagic username. - * @param {string} params.apiKey - Textmagic apiKey. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTextmagicProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Textmagic provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} username - Textmagic username. - * @param {string} apiKey - Textmagic apiKey. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextmagicProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; - createTextmagicProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - username: rest[2] as string, - apiKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const username = params.username; - const apiKey = params.apiKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/textmagic'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Textmagic provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.username - Textmagic username. - * @param {string} params.apiKey - Textmagic apiKey. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTextmagicProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Textmagic provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} username - Textmagic username. - * @param {string} apiKey - Textmagic apiKey. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextmagicProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; - updateTextmagicProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - username: rest[2] as string, - apiKey: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const username = params.username; - const apiKey = params.apiKey; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Twilio provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.accountSid - Twilio account secret ID. - * @param {string} params.authToken - Twilio authentication token. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTwilioProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Twilio provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} accountSid - Twilio account secret ID. - * @param {string} authToken - Twilio authentication token. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTwilioProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; - createTwilioProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - accountSid: rest[2] as string, - authToken: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const accountSid = params.accountSid; - const authToken = params.authToken; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/twilio'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; - } - if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Twilio provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.accountSid - Twilio account secret ID. - * @param {string} params.authToken - Twilio authentication token. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTwilioProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Twilio provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} accountSid - Twilio account secret ID. - * @param {string} authToken - Twilio authentication token. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTwilioProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; - updateTwilioProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - accountSid: rest[2] as string, - authToken: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const accountSid = params.accountSid; - const authToken = params.authToken; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; - } - if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Vonage provider. - * - * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.apiKey - Vonage API key. - * @param {string} params.apiSecret - Vonage API secret. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createVonageProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Vonage provider. - * - * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} apiKey - Vonage API key. - * @param {string} apiSecret - Vonage API secret. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVonageProvider(this: Messaging<ServerAuth>, providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; - createVonageProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - apiKey: rest[2] as string, - apiSecret: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/vonage'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Vonage provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Vonage API key. - * @param {string} params.apiSecret - Vonage API secret. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateVonageProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Vonage provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Vonage API key. - * @param {string} apiSecret - Vonage API secret. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVonageProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; - updateVonageProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - apiSecret: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a provider by its unique ID. - * - * - * @param {string} params.providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - getProvider(this: Messaging<ServerAuth>, params: { providerId: string }): Promise<Models.Provider>; - /** - * Get a provider by its unique ID. - * - * - * @param {string} providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getProvider(this: Messaging<ServerAuth>, providerId: string): Promise<Models.Provider>; - getProvider( - paramsOrFirst: { providerId: string } | string - ): Promise<Models.Provider> { - let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string }; - } else { - params = { - providerId: paramsOrFirst as string - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); - 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 provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteProvider(this: Messaging<ServerAuth>, params: { providerId: string }): Promise<{}>; - /** - * Delete a provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteProvider(this: Messaging<ServerAuth>, providerId: string): Promise<{}>; - deleteProvider( - paramsOrFirst: { providerId: string } | string - ): Promise<{}> { - let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string }; - } else { - params = { - providerId: paramsOrFirst as string - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the provider activity logs listed by its unique ID. - * - * @param {string} params.providerId - Provider 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). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listProviderLogs(this: Messaging<ServerAuth>, params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the provider activity logs listed by its unique ID. - * - * @param {string} providerId - Provider 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). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listProviderLogs(this: Messaging<ServerAuth>, providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listProviderLogs( - paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { providerId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, queries?: string[], total?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const providerId = params.providerId; - const queries = params.queries; - const total = params.total; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}/logs'.replace('{providerId}', providerId); - 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 the subscriber activity logs listed by its unique ID. - * - * @param {string} params.subscriberId - Subscriber 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). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listSubscriberLogs(this: Messaging<ServerAuth>, params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the subscriber activity logs listed by its unique ID. - * - * @param {string} subscriberId - Subscriber 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). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSubscriberLogs(this: Messaging<ServerAuth>, subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listSubscriberLogs( - paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { subscriberId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[], total?: boolean }; - } else { - params = { - subscriberId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const subscriberId = params.subscriberId; - const queries = params.queries; - const total = params.total; - - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - - const apiPath = '/messaging/subscribers/{subscriberId}/logs'.replace('{subscriberId}', subscriberId); - 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 a list of all topics from the current Appwrite project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TopicList>} - */ - listTopics(this: Messaging<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; - /** - * Get a list of all topics from the current Appwrite project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TopicList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTopics(this: Messaging<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; - listTopics( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.TopicList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/topics'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new topic. - * - * @param {string} params.topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. - * @param {string} params.name - Topic Name. - * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - createTopic(this: Messaging<ServerAuth>, params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; - /** - * Create a new topic. - * - * @param {string} topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. - * @param {string} name - Topic Name. - * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTopic(this: Messaging<ServerAuth>, topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; - createTopic( - paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Topic> { - let params: { topicId: string, name: string, subscribe?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, name: string, subscribe?: string[] }; - } else { - params = { - topicId: paramsOrFirst as string, - name: rest[0] as string, - subscribe: rest[1] as string[] - }; - } - - const topicId = params.topicId; - const name = params.name; - const subscribe = params.subscribe; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/topics'; - const payload: Payload = {}; - if (typeof topicId !== 'undefined') { - payload['topicId'] = topicId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a topic by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - getTopic(this: Messaging<ServerAuth>, params: { topicId: string }): Promise<Models.Topic>; - /** - * Get a topic by its unique ID. - * - * - * @param {string} topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTopic(this: Messaging<ServerAuth>, topicId: string): Promise<Models.Topic>; - getTopic( - paramsOrFirst: { topicId: string } | string - ): Promise<Models.Topic> { - let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string }; - } else { - params = { - topicId: paramsOrFirst as string - }; - } - - const topicId = params.topicId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a topic by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. - * @param {string} params.name - Topic Name. - * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - updateTopic(this: Messaging<ServerAuth>, params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; - /** - * Update a topic by its unique ID. - * - * - * @param {string} topicId - Topic ID. - * @param {string} name - Topic Name. - * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTopic(this: Messaging<ServerAuth>, topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; - updateTopic( - paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Topic> { - let params: { topicId: string, name?: string, subscribe?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, name?: string, subscribe?: string[] }; - } else { - params = { - topicId: paramsOrFirst as string, - name: rest[0] as string, - subscribe: rest[1] as string[] - }; - } - - const topicId = params.topicId; - const name = params.name; - const subscribe = params.subscribe; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; - } - 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 topic by its unique ID. - * - * @param {string} params.topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTopic(this: Messaging<ServerAuth>, params: { topicId: string }): Promise<{}>; - /** - * Delete a topic by its unique ID. - * - * @param {string} topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTopic(this: Messaging<ServerAuth>, topicId: string): Promise<{}>; - deleteTopic( - paramsOrFirst: { topicId: string } | string - ): Promise<{}> { - let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string }; - } else { - params = { - topicId: paramsOrFirst as string - }; - } - - const topicId = params.topicId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the topic activity logs listed by its unique ID. - * - * @param {string} params.topicId - Topic 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). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listTopicLogs(this: Messaging<ServerAuth>, params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the topic activity logs listed by its unique ID. - * - * @param {string} topicId - Topic 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). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTopicLogs(this: Messaging<ServerAuth>, topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listTopicLogs( - paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { topicId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], total?: boolean }; - } else { - params = { - topicId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const topicId = params.topicId; - const queries = params.queries; - const total = params.total; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}/logs'.replace('{topicId}', topicId); - 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 a list of all subscribers from the current Appwrite project. - * - * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SubscriberList>} - */ - listSubscribers(this: Messaging<ServerAuth>, params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; - /** - * Get a list of all subscribers from the current Appwrite project. - * - * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SubscriberList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSubscribers(this: Messaging<ServerAuth>, topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; - listSubscribers( - paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.SubscriberList> { - let params: { topicId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - topicId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const topicId = params.topicId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - 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 - ); + constructor(client: Client) { + this.client = client; } /** @@ -5080,67 +83,6 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } - /** - * Get a subscriber by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string} params.subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - */ - getSubscriber(this: Messaging<ServerAuth>, params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; - /** - * Get a subscriber by its unique ID. - * - * - * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string} subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getSubscriber(this: Messaging<ServerAuth>, topicId: string, subscriberId: string): Promise<Models.Subscriber>; - getSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Subscriber> { - let params: { topicId: string, subscriberId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; - } else { - params = { - topicId: paramsOrFirst as string, - subscriberId: rest[0] as string - }; - } - - const topicId = params.topicId; - const subscriberId = params.subscriberId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); - 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 subscriber by its unique ID. * @@ -5201,9 +143,3 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } } - -const Messaging = MessagingRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Messaging<TAuth>; -}; - -export { Messaging }; diff --git a/src/services/presences.ts b/src/services/presences.ts new file mode 100644 index 00000000..f9df9e18 --- /dev/null +++ b/src/services/presences.ts @@ -0,0 +1,363 @@ +import { Service } from '../service'; +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<Models.PresenceList<Presence>>} + */ + list<Presence extends Models.Presence = Models.DefaultPresence>(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise<Models.PresenceList<Presence>>; + /** + * 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<Models.PresenceList<Presence>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list<Presence extends Models.Presence = Models.DefaultPresence>(queries?: string[], total?: boolean, ttl?: number): Promise<Models.PresenceList<Presence>>; + list<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], + ...rest: [(boolean)?, (number)?] + ): Promise<Models.PresenceList<Presence>> { + 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<Presence>} + */ + get<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string }): Promise<Presence>; + /** + * 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<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string): Promise<Presence>; + get<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string } | string + ): Promise<Presence> { + 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.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<Presence>} + */ + upsert<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + /** + * Create or update a presence log by its user ID. + * + * + * @param {string} presenceId - Presence unique 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<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsert<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string[])?, (string)?, (object)?] + ): Promise<Presence> { + let params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + } else { + params = { + presenceId: paramsOrFirst as string, + status: rest[0] as string, + permissions: rest[1] as string[], + expiresAt: rest[2] as string, + metadata: rest[3] as object + }; + } + + const presenceId = params.presenceId; + 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 status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + 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.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<Presence>} + */ + update<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + /** + * 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} 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<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; + update<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise<Presence> { + let params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + } else { + params = { + presenceId: paramsOrFirst as string, + status: rest[0] as string, + expiresAt: rest[1] as string, + metadata: rest[2] as object, + permissions: rest[3] as string[], + purge: rest[4] as boolean + }; + } + + const presenceId = params.presenceId; + 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"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + 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 deleted file mode 100644 index f2d865c3..00000000 --- a/src/services/project.ts +++ /dev/null @@ -1,6443 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { AuthMethod } from '../enums/auth-method'; -import { Scopes } from '../enums/scopes'; -import { Prompt } from '../enums/prompt'; -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'; - -export type Project = Omit<ProjectRuntime, 'client'>; - -class ProjectRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Delete a project. - * - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(): Promise<{}> { - - const apiPath = '/project'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. - * - * @param {AuthMethod} 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<Models.Project>} - */ - updateAuthMethod(params: { methodId: AuthMethod, enabled: boolean }): Promise<Models.Project>; - /** - * 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 {boolean} enabled - Auth method status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAuthMethod(methodId: AuthMethod, enabled: boolean): Promise<Models.Project>; - updateAuthMethod( - paramsOrFirst: { methodId: AuthMethod, enabled: boolean } | AuthMethod, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { methodId: AuthMethod, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: AuthMethod, enabled: boolean }; - } else { - params = { - methodId: paramsOrFirst as AuthMethod, - enabled: rest[0] as boolean - }; - } - - const methodId = params.methodId; - const enabled = params.enabled; - - if (typeof methodId === 'undefined') { - throw new AppwriteException('Missing required parameter: "methodId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all API keys from the current project. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.KeyList>} - */ - listKeys(params?: { queries?: string[], total?: boolean }): Promise<Models.KeyList>; - /** - * Get a list of all API keys from the current project. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire, accessedAt, name, scopes - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.KeyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listKeys(queries?: string[], total?: boolean): Promise<Models.KeyList>; - listKeys( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.KeyList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/keys'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create an ephemeral API key if you need a short-lived key instead. - * - * @param {string} params.keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - createKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>; - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create an ephemeral API key if you need a short-lived key instead. - * - * @param {string} keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Key name. Max length: 128 chars. - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>; - createKey( - paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, - ...rest: [(string)?, (Scopes[])?, (string)?] - ): Promise<Models.Key> { - let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; - } else { - params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as Scopes[], - expire: rest[2] as string - }; - } - - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/project/keys'; - const payload: Payload = {}; - if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create a standard API key if you need a longer-lived key instead. - * - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.EphemeralKey>} - */ - createEphemeralKey(params: { scopes: Scopes[], duration: number }): Promise<Models.EphemeralKey>; - /** - * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create a standard API key if you need a longer-lived key instead. - * - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.EphemeralKey>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEphemeralKey(scopes: Scopes[], duration: number): Promise<Models.EphemeralKey>; - createEphemeralKey( - paramsOrFirst: { scopes: Scopes[], duration: number } | Scopes[], - ...rest: [(number)?] - ): Promise<Models.EphemeralKey> { - let params: { scopes: Scopes[], duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { scopes: Scopes[], duration: number }; - } else { - params = { - scopes: paramsOrFirst as Scopes[], - duration: rest[0] as number - }; - } - - const scopes = params.scopes; - const duration = params.duration; - - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - if (typeof duration === 'undefined') { - throw new AppwriteException('Missing required parameter: "duration"'); - } - - const apiPath = '/project/keys/ephemeral'; - const payload: Payload = {}; - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a key by its unique ID. - * - * @param {string} params.keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - getKey(params: { keyId: string }): Promise<Models.Key>; - /** - * Get a key by its unique ID. - * - * @param {string} keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getKey(keyId: string): Promise<Models.Key>; - getKey( - paramsOrFirst: { keyId: string } | string - ): Promise<Models.Key> { - let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; - } else { - params = { - keyId: paramsOrFirst as string - }; - } - - const keyId = params.keyId; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} params.keyId - Key ID. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>; - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} keyId - Key ID. - * @param {string} name - Key name. Max length: 128 chars. - * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>; - updateKey( - paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string, - ...rest: [(string)?, (Scopes[])?, (string)?] - ): Promise<Models.Key> { - let params: { keyId: string, name: string, scopes: Scopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string }; - } else { - params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as Scopes[], - expire: rest[2] as string - }; - } - - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} params.keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteKey(params: { keyId: string }): Promise<{}>; - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteKey(keyId: string): Promise<{}>; - deleteKey( - paramsOrFirst: { keyId: string } | string - ): Promise<{}> { - let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; - } else { - params = { - keyId: paramsOrFirst as string - }; - } - - const keyId = params.keyId; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project labels. Labels can be used to easily filter projects in an organization. - * - * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateLabels(params: { labels: string[] }): Promise<Models.Project>; - /** - * Update the project labels. Labels can be used to easily filter projects in an organization. - * - * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLabels(labels: string[]): Promise<Models.Project>; - updateLabels( - paramsOrFirst: { labels: string[] } | string[] - ): Promise<Models.Project> { - let params: { labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { labels: string[] }; - } else { - params = { - labels: paramsOrFirst as string[] - }; - } - - const labels = params.labels; - - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); - } - - const apiPath = '/project/labels'; - const payload: Payload = {}; - if (typeof labels !== 'undefined') { - payload['labels'] = labels; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumberList>} - */ - listMockPhones(params?: { queries?: string[], total?: boolean }): Promise<Models.MockNumberList>; - /** - * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumberList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMockPhones(queries?: string[], total?: boolean): Promise<Models.MockNumberList>; - listMockPhones( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.MockNumberList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/mock-phones'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. - * - * @param {string} params.number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - createMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; - /** - * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. - * - * @param {string} number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMockPhone(number: string, otp: string): Promise<Models.MockNumber>; - createMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.MockNumber> { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; - } else { - params = { - number: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const number = params.number; - const otp = params.otp; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/project/mock-phones'; - const payload: Payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - getMockPhone(params: { number: string }): Promise<Models.MockNumber>; - /** - * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMockPhone(number: string): Promise<Models.MockNumber>; - getMockPhone( - paramsOrFirst: { number: string } | string - ): Promise<Models.MockNumber> { - let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string }; - } else { - params = { - number: paramsOrFirst as string - }; - } - - const number = params.number; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - updateMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; - /** - * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMockPhone(number: string, otp: string): Promise<Models.MockNumber>; - updateMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.MockNumber> { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; - } else { - params = { - number: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const number = params.number; - const otp = params.otp; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMockPhone(params: { number: string }): Promise<{}>; - /** - * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMockPhone(number: string): Promise<{}>; - deleteMockPhone( - paramsOrFirst: { number: string } | string - ): Promise<{}> { - let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string }; - } else { - params = { - number: paramsOrFirst as string - }; - } - - const number = params.number; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2ProviderList>} - */ - listOAuth2Providers(params?: { queries?: string[], total?: boolean }): Promise<Models.OAuth2ProviderList>; - /** - * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2ProviderList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listOAuth2Providers(queries?: string[], total?: boolean): Promise<Models.OAuth2ProviderList>; - listOAuth2Providers( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.OAuth2ProviderList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/oauth2'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Amazon configuration. - * - * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Amazon>} - */ - updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Amazon>; - /** - * Update the project OAuth2 Amazon configuration. - * - * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Amazon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Amazon>; - updateOAuth2Amazon( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Amazon> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/amazon'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Apple configuration. - * - * @param {string} params.serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - * @param {string} params.keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - * @param {string} params.teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 - * @param {string} params.p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Apple>} - */ - updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise<Models.OAuth2Apple>; - /** - * Update the project OAuth2 Apple configuration. - * - * @param {string} serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - * @param {string} keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - * @param {string} teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 - * @param {string} p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Apple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise<Models.OAuth2Apple>; - updateOAuth2Apple( - paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Apple> { - let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; - } else { - params = { - serviceId: paramsOrFirst as string, - keyId: rest[0] as string, - teamId: rest[1] as string, - p8File: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const serviceId = params.serviceId; - const keyId = params.keyId; - const teamId = params.teamId; - const p8File = params.p8File; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/apple'; - const payload: Payload = {}; - if (typeof serviceId !== 'undefined') { - payload['serviceId'] = serviceId; - } - if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof p8File !== 'undefined') { - payload['p8File'] = p8File; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Auth0 configuration. - * - * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF - * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Auth0>} - */ - updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Auth0>; - /** - * Update the project OAuth2 Auth0 configuration. - * - * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF - * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Auth0>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Auth0>; - updateOAuth2Auth0( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Auth0> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/auth0'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Authentik configuration. - * - * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK - * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Authentik>} - */ - updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Authentik>; - /** - * Update the project OAuth2 Authentik configuration. - * - * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK - * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Authentik>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Authentik>; - updateOAuth2Authentik( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Authentik> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/authentik'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Autodesk configuration. - * - * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Autodesk>} - */ - updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Autodesk>; - /** - * Update the project OAuth2 Autodesk configuration. - * - * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Autodesk>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Autodesk>; - updateOAuth2Autodesk( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Autodesk> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/autodesk'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Bitbucket configuration. - * - * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitbucket>} - */ - updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitbucket>; - /** - * Update the project OAuth2 Bitbucket configuration. - * - * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitbucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise<Models.OAuth2Bitbucket>; - updateOAuth2Bitbucket( - paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Bitbucket> { - let params: { key?: string, secret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; - } else { - params = { - key: paramsOrFirst as string, - secret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const key = params.key; - const secret = params.secret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/bitbucket'; - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Bitly configuration. - * - * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitly>} - */ - updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitly>; - /** - * Update the project OAuth2 Bitly configuration. - * - * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitly>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Bitly>; - updateOAuth2Bitly( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Bitly> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/bitly'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Box configuration. - * - * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Box>} - */ - updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Box>; - /** - * Update the project OAuth2 Box configuration. - * - * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Box>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Box>; - updateOAuth2Box( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Box> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/box'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Dailymotion configuration. - * - * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dailymotion>} - */ - updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dailymotion>; - /** - * Update the project OAuth2 Dailymotion configuration. - * - * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dailymotion>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dailymotion>; - updateOAuth2Dailymotion( - paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Dailymotion> { - let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; - } else { - params = { - apiKey: paramsOrFirst as string, - apiSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/dailymotion'; - const payload: Payload = {}; - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Discord configuration. - * - * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Discord>} - */ - updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Discord>; - /** - * Update the project OAuth2 Discord configuration. - * - * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Discord>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Discord>; - updateOAuth2Discord( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Discord> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/discord'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Disqus configuration. - * - * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Disqus>} - */ - updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Disqus>; - /** - * Update the project OAuth2 Disqus configuration. - * - * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Disqus>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Disqus>; - updateOAuth2Disqus( - paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Disqus> { - let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - publicKey: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const publicKey = params.publicKey; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/disqus'; - const payload: Payload = {}; - if (typeof publicKey !== 'undefined') { - payload['publicKey'] = publicKey; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Dropbox configuration. - * - * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dropbox>} - */ - updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dropbox>; - /** - * Update the project OAuth2 Dropbox configuration. - * - * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dropbox>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dropbox>; - updateOAuth2Dropbox( - paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Dropbox> { - let params: { appKey?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; - } else { - params = { - appKey: paramsOrFirst as string, - appSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const appKey = params.appKey; - const appSecret = params.appSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/dropbox'; - const payload: Payload = {}; - if (typeof appKey !== 'undefined') { - payload['appKey'] = appKey; - } - if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Etsy configuration. - * - * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Etsy>} - */ - updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Etsy>; - /** - * Update the project OAuth2 Etsy configuration. - * - * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Etsy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise<Models.OAuth2Etsy>; - updateOAuth2Etsy( - paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Etsy> { - let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; - } else { - params = { - keyString: paramsOrFirst as string, - sharedSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const keyString = params.keyString; - const sharedSecret = params.sharedSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/etsy'; - const payload: Payload = {}; - if (typeof keyString !== 'undefined') { - payload['keyString'] = keyString; - } - if (typeof sharedSecret !== 'undefined') { - payload['sharedSecret'] = sharedSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Facebook configuration. - * - * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Facebook>} - */ - updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Facebook>; - /** - * Update the project OAuth2 Facebook configuration. - * - * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Facebook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Facebook>; - updateOAuth2Facebook( - paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Facebook> { - let params: { appId?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; - } else { - params = { - appId: paramsOrFirst as string, - appSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const appId = params.appId; - const appSecret = params.appSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/facebook'; - const payload: Payload = {}; - if (typeof appId !== 'undefined') { - payload['appId'] = appId; - } - if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Figma configuration. - * - * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Figma>} - */ - updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Figma>; - /** - * Update the project OAuth2 Figma configuration. - * - * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Figma>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Figma>; - updateOAuth2Figma( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Figma> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/figma'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 FusionAuth configuration. - * - * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc - * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2FusionAuth>} - */ - updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2FusionAuth>; - /** - * Update the project OAuth2 FusionAuth configuration. - * - * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc - * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2FusionAuth>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2FusionAuth>; - updateOAuth2FusionAuth( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2FusionAuth> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/fusionauth'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 GitHub configuration. - * - * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github>} - */ - updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Github>; - /** - * Update the project OAuth2 GitHub configuration. - * - * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Github>; - updateOAuth2GitHub( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Github> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/github'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Gitlab configuration. - * - * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 - * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Gitlab>} - */ - updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Gitlab>; - /** - * Update the project OAuth2 Gitlab configuration. - * - * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 - * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Gitlab>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Gitlab>; - updateOAuth2Gitlab( - paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Gitlab> { - let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - applicationId: paramsOrFirst as string, - secret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const applicationId = params.applicationId; - const secret = params.secret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/gitlab'; - const payload: Payload = {}; - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Google configuration. - * - * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj - * @param {Prompt[]} 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<Models.OAuth2Google>} - */ - updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }): Promise<Models.OAuth2Google>; - /** - * Update the project OAuth2 Google configuration. - * - * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj - * @param {Prompt[]} 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<Models.OAuth2Google>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Google(clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean): Promise<Models.OAuth2Google>; - updateOAuth2Google( - paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean } | string, - ...rest: [(string)?, (Prompt[])?, (boolean)?] - ): Promise<Models.OAuth2Google> { - let params: { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: Prompt[], enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - prompt: rest[1] as Prompt[], - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const prompt = params.prompt; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/google'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Keycloak configuration. - * - * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO - * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com - * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Keycloak>} - */ - updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise<Models.OAuth2Keycloak>; - /** - * Update the project OAuth2 Keycloak configuration. - * - * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO - * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com - * @param {string} realmName - Keycloak realm name. For example: appwrite-realm - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Keycloak>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise<Models.OAuth2Keycloak>; - updateOAuth2Keycloak( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Keycloak> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - realmName: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const realmName = params.realmName; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/keycloak'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof realmName !== 'undefined') { - payload['realmName'] = realmName; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Kick configuration. - * - * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Kick>} - */ - updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Kick>; - /** - * Update the project OAuth2 Kick configuration. - * - * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Kick>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Kick>; - updateOAuth2Kick( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Kick> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/kick'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Linkedin configuration. - * - * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Linkedin>} - */ - updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Linkedin>; - /** - * Update the project OAuth2 Linkedin configuration. - * - * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Linkedin>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Linkedin>; - updateOAuth2Linkedin( - paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Linkedin> { - let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - primaryClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const primaryClientSecret = params.primaryClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/linkedin'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof primaryClientSecret !== 'undefined') { - payload['primaryClientSecret'] = primaryClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Microsoft configuration. - * - * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Microsoft>} - */ - updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise<Models.OAuth2Microsoft>; - /** - * Update the project OAuth2 Microsoft configuration. - * - * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Microsoft>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise<Models.OAuth2Microsoft>; - updateOAuth2Microsoft( - paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Microsoft> { - let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; - } else { - params = { - applicationId: paramsOrFirst as string, - applicationSecret: rest[0] as string, - tenant: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const applicationId = params.applicationId; - const applicationSecret = params.applicationSecret; - const tenant = params.tenant; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/microsoft'; - const payload: Payload = {}; - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - if (typeof applicationSecret !== 'undefined') { - payload['applicationSecret'] = applicationSecret; - } - if (typeof tenant !== 'undefined') { - payload['tenant'] = tenant; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Notion configuration. - * - * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Notion>} - */ - updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Notion>; - /** - * Update the project OAuth2 Notion configuration. - * - * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Notion>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Notion>; - updateOAuth2Notion( - paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Notion> { - let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauthClientId: paramsOrFirst as string, - oauthClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauthClientId = params.oauthClientId; - const oauthClientSecret = params.oauthClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/notion'; - const payload: Payload = {}; - if (typeof oauthClientId !== 'undefined') { - payload['oauthClientId'] = oauthClientId; - } - if (typeof oauthClientSecret !== 'undefined') { - payload['oauthClientSecret'] = oauthClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Oidc configuration. - * - * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV - * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration - * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} params.userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Oidc>} - */ - updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise<Models.OAuth2Oidc>; - /** - * Update the project OAuth2 Oidc configuration. - * - * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV - * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration - * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Oidc>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise<Models.OAuth2Oidc>; - updateOAuth2Oidc( - paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Oidc> { - let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - wellKnownURL: rest[1] as string, - authorizationURL: rest[2] as string, - tokenURL: rest[3] as string, - userInfoURL: rest[4] as string, - enabled: rest[5] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const wellKnownURL = params.wellKnownURL; - const authorizationURL = params.authorizationURL; - const tokenURL = params.tokenURL; - const userInfoURL = params.userInfoURL; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/oidc'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof wellKnownURL !== 'undefined') { - payload['wellKnownURL'] = wellKnownURL; - } - if (typeof authorizationURL !== 'undefined') { - payload['authorizationURL'] = authorizationURL; - } - if (typeof tokenURL !== 'undefined') { - payload['tokenURL'] = tokenURL; - } - if (typeof userInfoURL !== 'undefined') { - payload['userInfoURL'] = userInfoURL; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Okta configuration. - * - * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV - * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ - * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Okta>} - */ - updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise<Models.OAuth2Okta>; - /** - * Update the project OAuth2 Okta configuration. - * - * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV - * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ - * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Okta>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise<Models.OAuth2Okta>; - updateOAuth2Okta( - paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Okta> { - let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - domain: rest[1] as string, - authorizationServerId: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const domain = params.domain; - const authorizationServerId = params.authorizationServerId; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/okta'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof authorizationServerId !== 'undefined') { - payload['authorizationServerId'] = authorizationServerId; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Paypal configuration. - * - * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - */ - updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; - /** - * Update the project OAuth2 Paypal configuration. - * - * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; - updateOAuth2Paypal( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Paypal> { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/paypal'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 PaypalSandbox configuration. - * - * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - */ - updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; - /** - * Update the project OAuth2 PaypalSandbox configuration. - * - * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; - updateOAuth2PaypalSandbox( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Paypal> { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/paypalSandbox'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Podio configuration. - * - * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Podio>} - */ - updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Podio>; - /** - * Update the project OAuth2 Podio configuration. - * - * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Podio>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Podio>; - updateOAuth2Podio( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Podio> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/podio'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Salesforce configuration. - * - * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Salesforce>} - */ - updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Salesforce>; - /** - * Update the project OAuth2 Salesforce configuration. - * - * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Salesforce>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise<Models.OAuth2Salesforce>; - updateOAuth2Salesforce( - paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Salesforce> { - let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; - } else { - params = { - customerKey: paramsOrFirst as string, - customerSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const customerKey = params.customerKey; - const customerSecret = params.customerSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/salesforce'; - const payload: Payload = {}; - if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; - } - if (typeof customerSecret !== 'undefined') { - payload['customerSecret'] = customerSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Slack configuration. - * - * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Slack>} - */ - updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Slack>; - /** - * Update the project OAuth2 Slack configuration. - * - * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Slack>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Slack>; - updateOAuth2Slack( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Slack> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/slack'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Spotify configuration. - * - * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Spotify>} - */ - updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Spotify>; - /** - * Update the project OAuth2 Spotify configuration. - * - * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Spotify>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Spotify>; - updateOAuth2Spotify( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Spotify> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/spotify'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Stripe configuration. - * - * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Stripe>} - */ - updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Stripe>; - /** - * Update the project OAuth2 Stripe configuration. - * - * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Stripe>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise<Models.OAuth2Stripe>; - updateOAuth2Stripe( - paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Stripe> { - let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - apiSecretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const apiSecretKey = params.apiSecretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/stripe'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof apiSecretKey !== 'undefined') { - payload['apiSecretKey'] = apiSecretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Tradeshift configuration. - * - * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - */ - updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; - /** - * Update the project OAuth2 Tradeshift configuration. - * - * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; - updateOAuth2Tradeshift( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Tradeshift> { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauth2ClientId: paramsOrFirst as string, - oauth2ClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauth2ClientId = params.oauth2ClientId; - const oauth2ClientSecret = params.oauth2ClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/tradeshift'; - const payload: Payload = {}; - if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; - } - if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Tradeshift Sandbox configuration. - * - * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - */ - updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; - /** - * Update the project OAuth2 Tradeshift Sandbox configuration. - * - * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; - updateOAuth2TradeshiftSandbox( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Tradeshift> { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauth2ClientId: paramsOrFirst as string, - oauth2ClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauth2ClientId = params.oauth2ClientId; - const oauth2ClientSecret = params.oauth2ClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/tradeshiftBox'; - const payload: Payload = {}; - if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; - } - if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Twitch configuration. - * - * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Twitch>} - */ - updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Twitch>; - /** - * Update the project OAuth2 Twitch configuration. - * - * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Twitch>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Twitch>; - updateOAuth2Twitch( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Twitch> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/twitch'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 WordPress configuration. - * - * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2WordPress>} - */ - updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2WordPress>; - /** - * Update the project OAuth2 WordPress configuration. - * - * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2WordPress>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2WordPress>; - updateOAuth2WordPress( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2WordPress> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/wordpress'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 X configuration. - * - * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2X>} - */ - updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2X>; - /** - * Update the project OAuth2 X configuration. - * - * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2X>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2X>; - updateOAuth2X( - paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2X> { - let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - customerKey: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const customerKey = params.customerKey; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/x'; - const payload: Payload = {}; - if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Yahoo configuration. - * - * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yahoo>} - */ - updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yahoo>; - /** - * Update the project OAuth2 Yahoo configuration. - * - * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yahoo>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yahoo>; - updateOAuth2Yahoo( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Yahoo> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/yahoo'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 Yandex configuration. - * - * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yandex>} - */ - updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yandex>; - /** - * Update the project OAuth2 Yandex configuration. - * - * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yandex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yandex>; - updateOAuth2Yandex( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Yandex> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/yandex'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * 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: 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<Models.OAuth2Zoho>} - */ - updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoho>; - /** - * 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: 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<Models.OAuth2Zoho>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoho>; - updateOAuth2Zoho( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Zoho> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/zoho'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the project OAuth2 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: 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<Models.OAuth2Zoom>} - */ - updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoom>; - /** - * 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: 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<Models.OAuth2Zoom>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoom>; - updateOAuth2Zoom( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Zoom> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/zoom'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * 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. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} - */ - getOAuth2Provider(params: { providerId: OAuthProvider }): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; - /** - * 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. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getOAuth2Provider(providerId: OAuthProvider): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; - getOAuth2Provider( - paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider - ): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft> { - let params: { providerId: OAuthProvider }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; - } else { - params = { - providerId: paramsOrFirst as OAuthProvider - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); - 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 - ); - } - - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformList>} - */ - listPlatforms(params?: { queries?: string[], total?: boolean }): Promise<Models.PlatformList>; - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPlatforms(queries?: string[], total?: boolean): Promise<Models.PlatformList>; - listPlatforms( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.PlatformList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/platforms'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - */ - createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; - /** - * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; - createAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformAndroid> { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - applicationId: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const applicationId = params.applicationId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof applicationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "applicationId"'); - } - - const apiPath = '/project/platforms/android'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - */ - updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; - /** - * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; - updateAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformAndroid> { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - applicationId: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const applicationId = params.applicationId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof applicationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "applicationId"'); - } - - const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - */ - createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; - /** - * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; - createApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformApple> { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - bundleIdentifier: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const bundleIdentifier = params.bundleIdentifier; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof bundleIdentifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); - } - - const apiPath = '/project/platforms/apple'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - */ - updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; - /** - * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; - updateApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformApple> { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - bundleIdentifier: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const bundleIdentifier = params.bundleIdentifier; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof bundleIdentifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); - } - - const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - */ - createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; - /** - * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; - createLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformLinux> { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageName = params.packageName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageName"'); - } - - const apiPath = '/project/platforms/linux'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - */ - updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; - /** - * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; - updateLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformLinux> { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageName = params.packageName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageName"'); - } - - const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - */ - createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; - /** - * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; - createWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWeb> { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - hostname: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const hostname = params.hostname; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof hostname === 'undefined') { - throw new AppwriteException('Missing required parameter: "hostname"'); - } - - const apiPath = '/project/platforms/web'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - */ - updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; - /** - * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; - updateWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWeb> { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - hostname: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const hostname = params.hostname; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof hostname === 'undefined') { - throw new AppwriteException('Missing required parameter: "hostname"'); - } - - const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - */ - createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; - /** - * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; - createWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWindows> { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageIdentifierName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageIdentifierName = params.packageIdentifierName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageIdentifierName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); - } - - const apiPath = '/project/platforms/windows'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - */ - updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; - /** - * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; - updateWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWindows> { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageIdentifierName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageIdentifierName = params.packageIdentifierName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageIdentifierName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); - } - - const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} params.platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} - */ - getPlatform(params: { platformId: string }): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPlatform(platformId: string): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; - getPlatform( - paramsOrFirst: { platformId: string } | string - ): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux> { - let params: { platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string }; - } else { - params = { - platformId: paramsOrFirst as string - }; - } - - const platformId = params.platformId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} params.platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePlatform(params: { platformId: string }): Promise<{}>; - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePlatform(platformId: string): Promise<{}>; - deletePlatform( - paramsOrFirst: { platformId: string } | string - ): Promise<{}> { - let params: { platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string }; - } else { - params = { - platformId: paramsOrFirst as string - }; - } - - const platformId = params.platformId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all project policies and their current configuration. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyList>} - */ - listPolicies(params?: { queries?: string[], total?: boolean }): Promise<Models.PolicyList>; - /** - * Get a list of all project policies and their current configuration. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPolicies(queries?: string[], total?: boolean): Promise<Models.PolicyList>; - listPolicies( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.PolicyList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/policies'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Configures if email aliases 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 email aliases during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateDenyCanonicalEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Configures if email aliases 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 email aliases during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyCanonicalEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyCanonicalEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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-canonical-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<Models.Project>} - */ - updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * 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<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyDisposableEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyDisposableEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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<Models.Project>} - */ - updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * 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<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyFreeEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyFreeEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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.. - * - * @param {boolean} params.userId - Set to true if you want make user ID visible to all team members, or false to hide it. - * @param {boolean} params.userEmail - Set to true if you want make user email visible to all team members, or false to hide it. - * @param {boolean} params.userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. - * @param {boolean} params.userName - Set to true if you want make user name visible to all team members, or false to hide it. - * @param {boolean} params.userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }): Promise<Models.Project>; - /** - * 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.. - * - * @param {boolean} userId - Set to true if you want make user ID visible to all team members, or false to hide it. - * @param {boolean} userEmail - Set to true if you want make user email visible to all team members, or false to hide it. - * @param {boolean} userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. - * @param {boolean} userName - Set to true if you want make user name visible to all team members, or false to hide it. - * @param {boolean} userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean): Promise<Models.Project>; - updateMembershipPrivacyPolicy( - paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean } | boolean, - ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Project> { - let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; - } else { - params = { - userId: paramsOrFirst as boolean, - userEmail: rest[0] as boolean, - userPhone: rest[1] as boolean, - userName: rest[2] as boolean, - userMFA: rest[3] as boolean - }; - } - - const userId = params.userId; - const userEmail = params.userEmail; - const userPhone = params.userPhone; - const userName = params.userName; - const userMFA = params.userMFA; - - - const apiPath = '/project/policies/membership-privacy'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof userEmail !== 'undefined') { - payload['userEmail'] = userEmail; - } - if (typeof userPhone !== 'undefined') { - payload['userPhone'] = userPhone; - } - if (typeof userName !== 'undefined') { - payload['userName'] = userName; - } - if (typeof userMFA !== 'undefined') { - payload['userMFA'] = userMFA; - } - 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 new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. - * - * @param {boolean} params.enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordDictionaryPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. - * - * @param {boolean} enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordDictionaryPolicy(enabled: boolean): Promise<Models.Project>; - updatePasswordDictionaryPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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/password-dictionary'; - 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 - ); - } - - /** - * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. - * - * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. - * - * @param {number} params.total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordHistoryPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. - * - * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. - * - * @param {number} total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordHistoryPolicy(total?: number): Promise<Models.Project>; - updatePasswordHistoryPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/password-history'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - 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 password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. - * - * @param {boolean} params.enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordPersonalDataPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. - * - * @param {boolean} enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordPersonalDataPolicy(enabled: boolean): Promise<Models.Project>; - updatePasswordPersonalDataPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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/password-personal-data'; - 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 email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. - * - * @param {boolean} params.enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionAlertPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. - * - * @param {boolean} enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionAlertPolicy(enabled: boolean): Promise<Models.Project>; - updateSessionAlertPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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/session-alert'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update maximum duration how long sessions created within a project should stay active for. - * - * @param {number} params.duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionDurationPolicy(params: { duration: number }): Promise<Models.Project>; - /** - * Update maximum duration how long sessions created within a project should stay active for. - * - * @param {number} duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionDurationPolicy(duration: number): Promise<Models.Project>; - updateSessionDurationPolicy( - paramsOrFirst: { duration: number } | number - ): Promise<Models.Project> { - let params: { duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { duration: number }; - } else { - params = { - duration: paramsOrFirst as number - }; - } - - const duration = params.duration; - - if (typeof duration === 'undefined') { - throw new AppwriteException('Missing required parameter: "duration"'); - } - - const apiPath = '/project/policies/session-duration'; - const payload: Payload = {}; - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. - * - * @param {boolean} params.enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionInvalidationPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. - * - * @param {boolean} enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionInvalidationPolicy(enabled: boolean): Promise<Models.Project>; - updateSessionInvalidationPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - 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/session-invalidation'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. - * - * @param {number} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionLimitPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. - * - * @param {number} total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionLimitPolicy(total?: number): Promise<Models.Project>; - updateSessionLimitPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/session-limit'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. - * - * @param {number} params.total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateUserLimitPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. - * - * @param {number} total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUserLimitPolicy(total?: number): Promise<Models.Project>; - updateUserLimitPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/user-limit'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a 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. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} - */ - getPolicy(params: { policyId: ProjectPolicy }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; - /** - * 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. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPolicy(policyId: ProjectPolicy): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; - getPolicy( - paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy - ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy> { - let params: { policyId: ProjectPolicy }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; - } else { - params = { - policyId: paramsOrFirst as ProjectPolicy - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. - * - * @param {ProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket - * @param {boolean} params.enabled - Protocol status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateProtocol(params: { protocolId: ProtocolId, enabled: boolean }): Promise<Models.Project>; - /** - * 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 {boolean} enabled - Protocol status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateProtocol(protocolId: ProtocolId, enabled: boolean): Promise<Models.Project>; - updateProtocol( - paramsOrFirst: { protocolId: ProtocolId, enabled: boolean } | ProtocolId, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { protocolId: ProtocolId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { protocolId: ProtocolId, enabled: boolean }; - } else { - params = { - protocolId: paramsOrFirst as ProtocolId, - enabled: rest[0] as boolean - }; - } - - const protocolId = params.protocolId; - const enabled = params.enabled; - - if (typeof protocolId === 'undefined') { - throw new AppwriteException('Missing required parameter: "protocolId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', protocolId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update 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 {boolean} params.enabled - Service status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateService(params: { serviceId: ServiceId, enabled: boolean }): Promise<Models.Project>; - /** - * 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 {boolean} enabled - Service status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateService(serviceId: ServiceId, enabled: boolean): Promise<Models.Project>; - updateService( - paramsOrFirst: { serviceId: ServiceId, enabled: boolean } | ServiceId, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { serviceId: ServiceId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId: ServiceId, enabled: boolean }; - } else { - params = { - serviceId: paramsOrFirst as ServiceId, - enabled: rest[0] as boolean - }; - } - - const serviceId = params.serviceId; - const enabled = params.enabled; - - if (typeof serviceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "serviceId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', serviceId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * 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. - * - * @param {string} params.host - SMTP server hostname (domain) - * @param {number} params.port - SMTP server port - * @param {string} params.username - SMTP server username. Leave empty for no authorization. - * @param {string} params.password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. - * @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 {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<Models.Project>} - */ - updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, enabled?: boolean }): Promise<Models.Project>; - /** - * 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. - * - * @param {string} host - SMTP server hostname (domain) - * @param {number} port - SMTP server port - * @param {string} username - SMTP server username. Leave empty for no authorization. - * @param {string} password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} senderEmail - Email address shown in inbox as the sender of the email. - * @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 {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<Models.Project>} - * @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<Models.Project>; - 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)?] - ): Promise<Models.Project> { - let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: Secure, 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 }; - } else { - params = { - host: paramsOrFirst as string, - port: rest[0] as number, - username: rest[1] as string, - password: rest[2] as string, - senderEmail: rest[3] as string, - senderName: rest[4] as string, - replyToEmail: rest[5] as string, - replyToName: rest[6] as string, - secure: rest[7] as Secure, - enabled: rest[8] as boolean - }; - } - - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const senderEmail = params.senderEmail; - const senderName = params.senderName; - const replyToEmail = params.replyToEmail; - const replyToName = params.replyToName; - const secure = params.secure; - const enabled = params.enabled; - - - const apiPath = '/project/smtp'; - const payload: Payload = {}; - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; - } - if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof secure !== 'undefined') { - payload['secure'] = secure; - } - 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 - ); - } - - /** - * Send a test email to verify SMTP configuration. - * - * @param {string[]} params.emails - Array of emails to send test email to. Maximum of 10 emails are allowed. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - createSMTPTest(params: { emails: string[] }): Promise<{}>; - /** - * Send a test email to verify SMTP configuration. - * - * @param {string[]} emails - Array of emails to send test email to. Maximum of 10 emails are allowed. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMTPTest(emails: string[]): Promise<{}>; - createSMTPTest( - paramsOrFirst: { emails: string[] } | string[] - ): Promise<{}> { - let params: { emails: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { emails: string[] }; - } else { - params = { - emails: paramsOrFirst as string[] - }; - } - - const emails = params.emails; - - if (typeof emails === 'undefined') { - throw new AppwriteException('Missing required parameter: "emails"'); - } - - const apiPath = '/project/smtp/tests'; - const payload: Payload = {}; - if (typeof emails !== 'undefined') { - payload['emails'] = emails; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplateList>} - */ - listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise<Models.EmailTemplateList>; - /** - * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplateList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEmailTemplates(queries?: string[], total?: boolean): Promise<Models.EmailTemplateList>; - listEmailTemplates( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.EmailTemplateList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/templates/email'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. - * - * @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 {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. - * @param {string} params.senderEmail - Email of the sender. - * @param {string} params.replyToEmail - Reply to email. - * @param {string} params.replyToName - Reply to name. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - */ - updateEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise<Models.EmailTemplate>; - /** - * 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 {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. - * @param {string} senderEmail - Email of the sender. - * @param {string} replyToEmail - Reply to email. - * @param {string} replyToName - Reply to name. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - * @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<Models.EmailTemplate>; - 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)?] - ): Promise<Models.EmailTemplate> { - let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale, 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 }; - } else { - params = { - templateId: paramsOrFirst as EmailTemplateType, - locale: rest[0] as EmailTemplateLocale, - subject: rest[1] as string, - message: rest[2] as string, - senderName: rest[3] as string, - senderEmail: rest[4] as string, - replyToEmail: rest[5] as string, - replyToName: rest[6] as string - }; - } - - const templateId = params.templateId; - const locale = params.locale; - const subject = params.subject; - const message = params.message; - const senderName = params.senderName; - const senderEmail = params.senderEmail; - const replyToEmail = params.replyToEmail; - const replyToName = params.replyToName; - - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); - } - - const apiPath = '/project/templates/email'; - const payload: Payload = {}; - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof locale !== 'undefined') { - payload['locale'] = locale; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof message !== 'undefined') { - payload['message'] = message; - } - if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; - } - if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a 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. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - */ - getEmailTemplate(params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }): Promise<Models.EmailTemplate>; - /** - * 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. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getEmailTemplate(templateId: EmailTemplateType, locale?: EmailTemplateLocale): Promise<Models.EmailTemplate>; - getEmailTemplate( - paramsOrFirst: { templateId: EmailTemplateType, locale?: EmailTemplateLocale } | EmailTemplateType, - ...rest: [(EmailTemplateLocale)?] - ): Promise<Models.EmailTemplate> { - let params: { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: EmailTemplateType, locale?: EmailTemplateLocale }; - } else { - params = { - templateId: paramsOrFirst as EmailTemplateType, - locale: rest[0] as EmailTemplateLocale - }; - } - - const templateId = params.templateId; - const locale = params.locale; - - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); - } - - const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', templateId); - const payload: Payload = {}; - if (typeof locale !== 'undefined') { - payload['locale'] = locale; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all project environment variables. - * - * @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: key, resourceType, resourceId, secret - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - */ - listVariables(params?: { queries?: string[], total?: boolean }): Promise<Models.VariableList>; - /** - * Get a list of all project environment variables. - * - * @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: key, resourceType, resourceId, secret - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listVariables(queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.VariableList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/variables'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. - * - * @param {string} params.variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. - * - * @param {string} variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - variableId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean - }; - } - - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/project/variables'; - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - getVariable(params: { variableId: string }): Promise<Models.Variable>; - /** - * Get a variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getVariable(variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { variableId: string } | string - ): Promise<Models.Variable> { - let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string }; - } else { - params = { - variableId: paramsOrFirst as string - }; - } - - const variableId = params.variableId; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - variableId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean - }; - } - - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteVariable(params: { variableId: string }): Promise<{}>; - /** - * Delete a variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteVariable(variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { variableId: string } | string - ): Promise<{}> { - let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string }; - } else { - params = { - variableId: paramsOrFirst as string - }; - } - - const variableId = params.variableId; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - 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 - ); - } -} - -const Project = ProjectRuntime as unknown as { - new (client: Client<ServerAuth>): Project; -}; - -export { Project }; diff --git a/src/services/proxy.ts b/src/services/proxy.ts deleted file mode 100644 index 6e8e0919..00000000 --- a/src/services/proxy.ts +++ /dev/null @@ -1,548 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { StatusCode } from '../enums/status-code'; -import { ProxyResourceType } from '../enums/proxy-resource-type'; - -export type Proxy = Omit<ProxyRuntime, 'client'>; - -class ProxyRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Get a list of all the proxy rules. 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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRuleList>} - */ - listRules(params?: { queries?: string[], total?: boolean }): Promise<Models.ProxyRuleList>; - /** - * Get a list of all the proxy rules. 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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRuleList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRules(queries?: string[], total?: boolean): Promise<Models.ProxyRuleList>; - listRules( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.ProxyRuleList> { - 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 = '/proxy/rules'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new proxy rule for serving Appwrite's API on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createAPIRule(params: { domain: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for serving Appwrite's API on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAPIRule(domain: string): Promise<Models.ProxyRule>; - createAPIRule( - paramsOrFirst: { domain: string } | string - ): Promise<Models.ProxyRule> { - let params: { domain: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string }; - } else { - params = { - domain: paramsOrFirst as string - }; - } - - const domain = params.domain; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - - const apiPath = '/proxy/rules/api'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new proxy rule for executing Appwrite Function on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.functionId - ID of function to be executed. - * @param {string} params.branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createFunctionRule(params: { domain: string, functionId: string, branch?: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for executing Appwrite Function on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} functionId - ID of function to be executed. - * @param {string} branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFunctionRule(domain: string, functionId: string, branch?: string): Promise<Models.ProxyRule>; - createFunctionRule( - paramsOrFirst: { domain: string, functionId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, functionId: string, branch?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, functionId: string, branch?: string }; - } else { - params = { - domain: paramsOrFirst as string, - functionId: rest[0] as string, - branch: rest[1] as string - }; - } - - const domain = params.domain; - const functionId = params.functionId; - const branch = params.branch; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/proxy/rules/function'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; - } - if (typeof branch !== 'undefined') { - payload['branch'] = branch; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new proxy rule for to redirect from custom domain to another domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.url - Target URL of redirection - * @param {StatusCode} params.statusCode - Status code of redirection - * @param {string} params.resourceId - ID of parent resource. - * @param {ProxyResourceType} params.resourceType - Type of parent resource. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for to redirect from custom domain to another domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} url - Target URL of redirection - * @param {StatusCode} statusCode - Status code of redirection - * @param {string} resourceId - ID of parent resource. - * @param {ProxyResourceType} resourceType - Type of parent resource. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise<Models.ProxyRule>; - createRedirectRule( - paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, - ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; - } else { - params = { - domain: paramsOrFirst as string, - url: rest[0] as string, - statusCode: rest[1] as StatusCode, - resourceId: rest[2] as string, - resourceType: rest[3] as ProxyResourceType - }; - } - - const domain = params.domain; - const url = params.url; - const statusCode = params.statusCode; - const resourceId = params.resourceId; - const resourceType = params.resourceType; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof statusCode === 'undefined') { - throw new AppwriteException('Missing required parameter: "statusCode"'); - } - if (typeof resourceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceId"'); - } - if (typeof resourceType === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceType"'); - } - - const apiPath = '/proxy/rules/redirect'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof statusCode !== 'undefined') { - payload['statusCode'] = statusCode; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - if (typeof resourceType !== 'undefined') { - payload['resourceType'] = resourceType; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new proxy rule for serving Appwrite Site on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.siteId - ID of site to be executed. - * @param {string} params.branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createSiteRule(params: { domain: string, siteId: string, branch?: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for serving Appwrite Site on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} siteId - ID of site to be executed. - * @param {string} branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSiteRule(domain: string, siteId: string, branch?: string): Promise<Models.ProxyRule>; - createSiteRule( - paramsOrFirst: { domain: string, siteId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, siteId: string, branch?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, siteId: string, branch?: string }; - } else { - params = { - domain: paramsOrFirst as string, - siteId: rest[0] as string, - branch: rest[1] as string - }; - } - - const domain = params.domain; - const siteId = params.siteId; - const branch = params.branch; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/proxy/rules/site'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; - } - if (typeof branch !== 'undefined') { - payload['branch'] = branch; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a proxy rule by its unique ID. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - getRule(params: { ruleId: string }): Promise<Models.ProxyRule>; - /** - * Get a proxy rule by its unique ID. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRule(ruleId: string): Promise<Models.ProxyRule>; - getRule( - paramsOrFirst: { ruleId: string } | string - ): Promise<Models.ProxyRule> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); - 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 proxy rule by its unique ID. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteRule(params: { ruleId: string }): Promise<{}>; - /** - * Delete a proxy rule by its unique ID. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteRule(ruleId: string): Promise<{}>; - deleteRule( - paramsOrFirst: { ruleId: string } | string - ): Promise<{}> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); - 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 - ); - } - - /** - * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - updateRuleStatus(params: { ruleId: string }): Promise<Models.ProxyRule>; - /** - * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRuleStatus(ruleId: string): Promise<Models.ProxyRule>; - updateRuleStatus( - paramsOrFirst: { ruleId: string } | string - ): Promise<Models.ProxyRule> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', ruleId); - 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( - 'patch', - uri, - apiHeaders, - payload - ); - } -} - -const Proxy = ProxyRuntime as unknown as { - new (client: Client<ServerAuth>): Proxy; -}; - -export { Proxy }; diff --git a/src/services/realtime.ts b/src/services/realtime.ts index 71436bf4..8e34310b 100644 --- a/src/services/realtime.ts +++ b/src/services/realtime.ts @@ -1,4 +1,4 @@ -import { AppwriteException, Client, JSONbig, type ClientAuth } from '../client'; +import { AppwriteException, Client, JSONbig } from '../client'; import { Channel, ActionableChannel, ResolvedChannel } from '../channel'; import { Query } from '../query'; import { ID } from '../id'; @@ -52,10 +52,31 @@ export type RealtimeResponseConnected = { } export type RealtimeRequest = { - type: 'authentication' | 'subscribe' | 'unsubscribe'; + type: 'authentication' | 'subscribe' | 'unsubscribe' | 'presence'; data: any; } +export type RealtimePresence = { + $id: string; + $sequence?: string | number; + $createdAt: string; + $updatedAt: string; + $permissions: string[]; + userInternalId: string; + userId: string; + status?: string; + source: string; + expiry?: string; + metadata?: Record<string, any>; +} + +export type RealtimePresenceCreate = { + status: string; + presenceId: string; + permissions?: string[]; + metadata?: Record<string, any>; +} + type RealtimeRequestSubscribeRow = { subscriptionId?: string; channels: string[]; @@ -73,15 +94,20 @@ export class Realtime { private readonly TYPE_EVENT = 'event'; private readonly TYPE_PONG = 'pong'; private readonly TYPE_CONNECTED = 'connected'; - private readonly TYPE_RESPONSE = 'response'; private readonly DEBOUNCE_MS = 1; private readonly HEARTBEAT_INTERVAL = 20000; // 20 seconds in milliseconds - private client: Client<ClientAuth>; + private client: Client; private socket?: WebSocket; private activeSubscriptions = new Map<string, RealtimeCallback<any>>(); private pendingSubscribes = new Map<string, RealtimeRequestSubscribeRow>(); + private pendingPresence?: Record<string, any>; + private appConnected = false; private heartbeatTimer?: number; + // Single-flight lock for createSocket(). When set, concurrent callers join + // this promise instead of issuing a second `new WebSocket(...)`. Cleared + // after the underlying connect resolves or rejects. + private socketCreationPromise?: Promise<void>; private subCallDepth = 0; private reconnectAttempts = 0; @@ -92,7 +118,7 @@ export class Realtime { private onCloseCallbacks: Array<() => void> = []; private onOpenCallbacks: Array<() => void> = []; - constructor(client: Client<ClientAuth>) { + constructor(client: Client) { this.client = client; } @@ -128,32 +154,47 @@ export class Realtime { private startHeartbeat(): void { this.stopHeartbeat(); - this.heartbeatTimer = typeof window !== 'undefined' - ? window.setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL) - : setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL) as unknown as number; + this.heartbeatTimer = window?.setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL); } private stopHeartbeat(): void { if (this.heartbeatTimer) { - if (typeof window !== 'undefined') { - window.clearInterval(this.heartbeatTimer); - } else { - clearInterval(this.heartbeatTimer as any); - } + window?.clearInterval(this.heartbeatTimer); this.heartbeatTimer = undefined; } } + /** + * Idempotent socket opener. Both `subscribe()` and `upsertPresence()` can + * call this; the single-flight lock (`socketCreationPromise`) guarantees + * only one `new WebSocket(...)` is ever in flight, so concurrent callers + * join the same connection attempt instead of opening duplicates. + * + * Returns early when a healthy socket is already present. + */ private async createSocket(): Promise<void> { - if (this.activeSubscriptions.size === 0) { + // Fast path: a usable socket is already there. No need to open another. + if (this.socket && this.socket.readyState < WebSocket.CLOSING) { + return; + } + // Another caller is already opening one — join it. + if (this.socketCreationPromise) { + return this.socketCreationPromise; + } + this.socketCreationPromise = this.createSocketLocked().finally(() => { + this.socketCreationPromise = undefined; + }); + return this.socketCreationPromise; + } + + private async createSocketLocked(): Promise<void> { + // Nothing to do if there's neither a subscription nor a queued presence + // that needs the wire. (Reconnect cleanup path also flows through here.) + if (this.activeSubscriptions.size === 0 && !this.pendingPresence) { this.reconnect = false; await this.closeSocket(); return; @@ -186,6 +227,15 @@ export class Realtime { } return new Promise((resolve, reject) => { + // Re-check the entry guard synchronously. `disconnect()` may have + // run during the `await this.closeSocket()` above (or any other + // await between the original guard and here), clearing every + // subscription and the pending presence. In that case opening a + // fresh socket would leak a connection with nothing attached. + if (this.activeSubscriptions.size === 0 && !this.pendingPresence) { + resolve(); + return; + } try { const connectionId = ++this.connectionId; const socket = (this.socket = new WebSocket(url)); @@ -216,6 +266,7 @@ export class Realtime { if (connectionId !== this.connectionId || socket !== this.socket) { return; } + this.appConnected = false; this.stopHeartbeat(); this.onCloseCallbacks.forEach(callback => callback()); @@ -336,7 +387,19 @@ export class Realtime { public async disconnect(): Promise<void> { this.activeSubscriptions.clear(); this.pendingSubscribes.clear(); + this.pendingPresence = undefined; + this.appConnected = false; this.reconnect = false; + // Drop the in-flight single-flight slot. Promises can't be cancelled, + // so the underlying createSocketLocked() promise may stay pending + // forever — e.g. when closeSocket() below tears down a CONNECTING + // socket, the `close` event fires but `open`/`error` never do, and + // the inner `new Promise(...)` only resolves on those. Without this + // line, the next subscribe()/upsertPresence() would join the orphan + // promise via the single-flight gate and hang, leaving its pending + // subscription queued with no socket ever opened. Mirrors the Swift + // template's socketCreationTask cancel in disconnect(). + this.socketCreationPromise = undefined; await this.closeSocket(); } @@ -344,6 +407,18 @@ export class Realtime { if (!this.socket || this.socket.readyState !== WebSocket.OPEN) { return; } + // The WebSocket 'open' event fires when the TCP/upgrade handshake + // completes — but the server only accepts `subscribe` frames after + // it has emitted its own application-level `connected` event (which + // flips `appConnected` to true in handleResponseConnected). Sending + // before then triggers a policy-violation close on real Appwrite, + // which reconnects, which sends early again — i.e. a duplicate- + // socket loop. handleResponseConnected re-enqueues every active + // subscription and calls this method again once it's safe, so the + // queued rows are guaranteed to be sent. + if (!this.appConnected) { + return; + } if (this.pendingSubscribes.size < 1) { return; @@ -542,6 +617,66 @@ export class Realtime { return { unsubscribe, update, close }; } + /** + * Fire-and-forget presence upsert. Records the latest payload in state so + * that — if the WebSocket isn't open yet, or later reconnects — only the + * most recent presence is automatically (re)sent on the next `connected` + * event. Repeated calls while the socket is closed collapse to the latest + * payload (older ones are discarded). + * + * Returns a `Promise<void>` for API consistency; the promise resolves as + * soon as the payload has been stored and the opportunistic send attempted. + * + * @param {RealtimePresenceCreate} params - Presence payload (status and presenceId required, permissions/metadata optional) + */ + public async upsertPresence(params: RealtimePresenceCreate): Promise<void> { + const data: Record<string, any> = { + status: params.status, + presenceId: params.presenceId, + }; + if (params.permissions !== undefined) { + data.permissions = params.permissions; + } + if (params.metadata !== undefined) { + data.metadata = params.metadata; + } + + this.pendingPresence = data; + + // Both subscribe() and upsertPresence() may need to open the socket. + // createSocket() is single-flight (see `socketCreationPromise`), so + // calling it here is a no-op when a connection is already in flight or + // healthy. Fire-and-forget keeps the documented fire-and-forget shape + // of upsertPresence: the returned Promise resolves as soon as the + // payload is stored. + if (!this.socket || this.socket.readyState >= WebSocket.CLOSING) { + this.createSocket().catch((error) => { + console.error('Failed to open realtime socket for presence:', error); + }); + } + + // Opportunistic send for the case where the socket is already past the + // `connected` handshake. The gate inside flushPendingPresence keeps + // this a no-op until appConnected flips to true. + this.flushPendingPresence(); + } + + private flushPendingPresence(): void { + if (!this.pendingPresence) { + return; + } + if (!this.socket || this.socket.readyState !== WebSocket.OPEN) { + return; + } + if (!this.appConnected) { + return; + } + this.socket.send(JSONbig.stringify(<RealtimeRequest>{ + type: 'presence', + data: this.pendingPresence + })); + } + private handleMessage(message: RealtimeResponse): void { if (!message.type) { return; @@ -560,9 +695,6 @@ export class Realtime { case this.TYPE_PONG: // Handle pong response if needed break; - case this.TYPE_RESPONSE: - this.handleResponseAction(message); - break; } } @@ -576,10 +708,8 @@ export class Realtime { let session = this.client.config.session; if (!session) { try { - if (typeof window !== 'undefined' && window.localStorage) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.client.config.project}`]; - } + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.client.config.project}`]; } catch (error) { console.error('Failed to parse cookie fallback:', error); } @@ -597,7 +727,9 @@ export class Realtime { for (const subscriptionId of this.activeSubscriptions.keys()) { this.enqueuePendingSubscribe(subscriptionId); } + this.appConnected = true; this.sendPendingSubscribes(); + this.flushPendingPresence(); } private handleResponseError(message: RealtimeResponse): void { @@ -638,10 +770,4 @@ export class Realtime { }); } } - - private handleResponseAction(_message: RealtimeResponse): void { - // The SDK generates subscriptionIds client-side and sends them on every - // subscribe/unsubscribe, so subscribe/unsubscribe acks carry no state - // the SDK needs to reconcile. - } } diff --git a/src/services/sites.ts b/src/services/sites.ts deleted file mode 100644 index 5e3827af..00000000 --- a/src/services/sites.ts +++ /dev/null @@ -1,1925 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type ServerAuth, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { Framework } from '../enums/framework'; -import { BuildRuntime } from '../enums/build-runtime'; -import { Adapter } from '../enums/adapter'; -import { TemplateReferenceType } from '../enums/template-reference-type'; -import { VCSReferenceType } from '../enums/vcs-reference-type'; -import { DeploymentDownloadType } from '../enums/deployment-download-type'; - -export type Sites = Omit<SitesRuntime, 'client'>; - -class SitesRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Get a list of all the project's sites. You can use the query params to filter your results. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SiteList>} - */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.SiteList>; - /** - * Get a list of all the project's sites. You can use the query params to filter your results. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SiteList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.SiteList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/sites'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new site. - * - * @param {string} params.siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Site name. Max length: 128 chars. - * @param {Framework} params.framework - Sites framework. - * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. - * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} params.timeout - Maximum request time in seconds. - * @param {string} params.installCommand - Install Command. - * @param {string} params.buildCommand - Build Command. - * @param {string} params.startCommand - Custom start command. Leave empty to use default. - * @param {string} params.outputDirectory - Output Directory for site. - * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.fallbackFile - Fallback file for single page application sites. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} params.providerBranch - Production branch for the repo linked to the site. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to site code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the site deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; - /** - * Create a new site. - * - * @param {string} siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Site name. Max length: 128 chars. - * @param {Framework} framework - Sites framework. - * @param {BuildRuntime} buildRuntime - Runtime to use during build step. - * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} timeout - Maximum request time in seconds. - * @param {string} installCommand - Install Command. - * @param {string} buildCommand - Build Command. - * @param {string} startCommand - Custom start command. Leave empty to use default. - * @param {string} outputDirectory - Output Directory for site. - * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} fallbackFile - Fallback file for single page application sites. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} providerBranch - Production branch for the repo linked to the site. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to site code in the linked repo. - * @param {string} buildSpecification - Build specification for the site deployments. - * @param {string} runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; - create( - paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - siteId: paramsOrFirst as string, - name: rest[0] as string, - framework: rest[1] as Framework, - buildRuntime: rest[2] as BuildRuntime, - enabled: rest[3] as boolean, - logging: rest[4] as boolean, - timeout: rest[5] as number, - installCommand: rest[6] as string, - buildCommand: rest[7] as string, - startCommand: rest[8] as string, - outputDirectory: rest[9] as string, - adapter: rest[10] as Adapter, - installationId: rest[11] as string, - fallbackFile: rest[12] as string, - providerRepositoryId: rest[13] as string, - providerBranch: rest[14] as string, - providerSilentMode: rest[15] as boolean, - providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number - }; - } - - const siteId = params.siteId; - const name = params.name; - const framework = params.framework; - const buildRuntime = params.buildRuntime; - const enabled = params.enabled; - const logging = params.logging; - const timeout = params.timeout; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const startCommand = params.startCommand; - const outputDirectory = params.outputDirectory; - const adapter = params.adapter; - const installationId = params.installationId; - const fallbackFile = params.fallbackFile; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); - } - if (typeof buildRuntime === 'undefined') { - throw new AppwriteException('Missing required parameter: "buildRuntime"'); - } - - const apiPath = '/sites'; - const payload: Payload = {}; - if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof framework !== 'undefined') { - payload['framework'] = framework; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; - } - if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all frameworks that are currently available on the server instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.FrameworkList>} - */ - listFrameworks(): Promise<Models.FrameworkList> { - - const apiPath = '/sites/frameworks'; - 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 - ); - } - - /** - * List allowed site specifications for this instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.SpecificationList>} - */ - listSpecifications(): Promise<Models.SpecificationList> { - - const apiPath = '/sites/specifications'; - 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 - ); - } - - /** - * Get a site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - get(params: { siteId: string }): Promise<Models.Site>; - /** - * Get a site by its unique ID. - * - * @param {string} siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(siteId: string): Promise<Models.Site>; - get( - paramsOrFirst: { siteId: string } | string - ): Promise<Models.Site> { - let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string }; - } else { - params = { - siteId: paramsOrFirst as string - }; - } - - const siteId = params.siteId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.name - Site name. Max length: 128 chars. - * @param {Framework} params.framework - Sites framework. - * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} params.timeout - Maximum request time in seconds. - * @param {string} params.installCommand - Install Command. - * @param {string} params.buildCommand - Build Command. - * @param {string} params.startCommand - Custom start command. Leave empty to use default. - * @param {string} params.outputDirectory - Output Directory for site. - * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. - * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} params.fallbackFile - Fallback file for single page application sites. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} params.providerBranch - Production branch for the repo linked to the site. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to site code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the site deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; - /** - * Update site by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} name - Site name. Max length: 128 chars. - * @param {Framework} framework - Sites framework. - * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} timeout - Maximum request time in seconds. - * @param {string} installCommand - Install Command. - * @param {string} buildCommand - Build Command. - * @param {string} startCommand - Custom start command. Leave empty to use default. - * @param {string} outputDirectory - Output Directory for site. - * @param {BuildRuntime} buildRuntime - Runtime to use during build step. - * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} fallbackFile - Fallback file for single page application sites. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} providerBranch - Production branch for the repo linked to the site. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to site code in the linked repo. - * @param {string} buildSpecification - Build specification for the site deployments. - * @param {string} runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; - update( - paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - siteId: paramsOrFirst as string, - name: rest[0] as string, - framework: rest[1] as Framework, - enabled: rest[2] as boolean, - logging: rest[3] as boolean, - timeout: rest[4] as number, - installCommand: rest[5] as string, - buildCommand: rest[6] as string, - startCommand: rest[7] as string, - outputDirectory: rest[8] as string, - buildRuntime: rest[9] as BuildRuntime, - adapter: rest[10] as Adapter, - fallbackFile: rest[11] as string, - installationId: rest[12] as string, - providerRepositoryId: rest[13] as string, - providerBranch: rest[14] as string, - providerSilentMode: rest[15] as boolean, - providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number - }; - } - - const siteId = params.siteId; - const name = params.name; - const framework = params.framework; - const enabled = params.enabled; - const logging = params.logging; - const timeout = params.timeout; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const startCommand = params.startCommand; - const outputDirectory = params.outputDirectory; - const buildRuntime = params.buildRuntime; - const adapter = params.adapter; - const fallbackFile = params.fallbackFile; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof framework !== 'undefined') { - payload['framework'] = framework; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; - } - if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; - } - if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { siteId: string }): Promise<{}>; - /** - * Delete a site by its unique ID. - * - * @param {string} siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(siteId: string): Promise<{}>; - delete( - paramsOrFirst: { siteId: string } | string - ): Promise<{}> { - let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string }; - } else { - params = { - siteId: paramsOrFirst as string - }; - } - - const siteId = params.siteId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Site>; - /** - * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSiteDeployment(siteId: string, deploymentId: string): Promise<Models.Site>; - updateSiteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Site> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all the site's code deployments. You can use the query params to filter your results. - * - * @param {string} params.siteId - Site 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - */ - listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; - /** - * Get a list of all the site's code deployments. You can use the query params to filter your results. - * - * @param {string} siteId - Site 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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; - listDeployments( - paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.DeploymentList> { - let params: { siteId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. - * - * @param {string} params.siteId - Site ID. - * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {string} params.installCommand - Install Commands. - * @param {string} params.buildCommand - Build Commands. - * @param {string} params.outputDirectory - Output Directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDeployment(params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; - /** - * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. - * - * @param {string} siteId - Site ID. - * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {string} installCommand - Install Commands. - * @param {string} buildCommand - Build Commands. - * @param {string} outputDirectory - Output Directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDeployment(siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - siteId: paramsOrFirst as string, - code: rest[0] as File, - installCommand: rest[1] as string, - buildCommand: rest[2] as string, - outputDirectory: rest[3] as string, - activate: rest[4] as boolean - }; - onProgress = rest[5] as ((progress: UploadProgress) => void); - } - - const siteId = params.siteId; - const code = params.code; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const outputDirectory = params.outputDirectory; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof code !== 'undefined') { - payload['code'] = code; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', - } - - return this.client.chunkedUpload( - 'post', - uri, - apiHeaders, - payload, - onProgress - ); - } - - /** - * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDuplicateDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; - createDuplicateDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.repository - Repository name of the template. - * @param {string} params.owner - The name of the owner of the template. - * @param {string} params.rootDirectory - Path to site code in the template repo. - * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. - * - * @param {string} siteId - Site ID. - * @param {string} repository - Repository name of the template. - * @param {string} owner - The name of the owner of the template. - * @param {string} rootDirectory - Path to site code in the template repo. - * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createTemplateDeployment( - paramsOrFirst: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - repository: rest[0] as string, - owner: rest[1] as string, - rootDirectory: rest[2] as string, - type: rest[3] as TemplateReferenceType, - reference: rest[4] as string, - activate: rest[5] as boolean - }; - } - - const siteId = params.siteId; - const repository = params.repository; - const owner = params.owner; - const rootDirectory = params.rootDirectory; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof repository === 'undefined') { - throw new AppwriteException('Missing required parameter: "repository"'); - } - if (typeof owner === 'undefined') { - throw new AppwriteException('Missing required parameter: "owner"'); - } - if (typeof rootDirectory === 'undefined') { - throw new AppwriteException('Missing required parameter: "rootDirectory"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof repository !== 'undefined') { - payload['repository'] = repository; - } - if (typeof owner !== 'undefined') { - payload['owner'] = owner; - } - if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a deployment when a site is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} params.siteId - Site ID. - * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit - * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment when a site is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} siteId - Site ID. - * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit - * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createVcsDeployment( - paramsOrFirst: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - type: rest[0] as VCSReferenceType, - reference: rest[1] as string, - activate: rest[2] as boolean - }; - } - - const siteId = params.siteId; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a site deployment by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - getDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Get a site deployment by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; - getDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - 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 site deployment by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; - /** - * Delete a site deployment by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDeployment(siteId: string, deploymentId: string): Promise<{}>; - deleteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {string} - */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): string; - /** - * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {string} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): string; - getDeploymentDownload( - paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] - ): string { - let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - const type = params.type; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; - - for (const [key, value] of Object.entries(Service.flatten(payload))) { - uri.searchParams.append(key, value); - } - - return uri.toString(); - } - - /** - * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDeploymentStatus(siteId: string, deploymentId: string): Promise<Models.Deployment>; - updateDeploymentStatus( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - 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( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all site logs. You can use the query params to filter your results. - * - * @param {string} params.siteId - Site 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - */ - listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; - /** - * Get a list of all site logs. You can use the query params to filter your results. - * - * @param {string} siteId - Site 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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listLogs( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { - let params: { siteId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId); - 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 a site request log by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - getLog(params: { siteId: string, logId: string }): Promise<Models.Execution>; - /** - * Get a site request log by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getLog(siteId: string, logId: string): Promise<Models.Execution>; - getLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { siteId: string, logId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, logId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - logId: rest[0] as string - }; - } - - const siteId = params.siteId; - const logId = params.logId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof logId === 'undefined') { - throw new AppwriteException('Missing required parameter: "logId"'); - } - - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); - 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 site log by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteLog(params: { siteId: string, logId: string }): Promise<{}>; - /** - * Delete a site log by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteLog(siteId: string, logId: string): Promise<{}>; - deleteLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, logId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, logId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - logId: rest[0] as string - }; - } - - const siteId = params.siteId; - const logId = params.logId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof logId === 'undefined') { - throw new AppwriteException('Missing required parameter: "logId"'); - } - - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all variables of a specific site. - * - * @param {string} params.siteId - Site unique ID. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - */ - listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; - /** - * Get a list of all variables of a specific site. - * - * @param {string} siteId - Site unique ID. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listVariables(siteId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.VariableList> { - let params: { siteId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable 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.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable 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} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - getVariable(params: { siteId: string, variableId: string }): Promise<Models.Variable>; - /** - * Get a variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getVariable(siteId: string, variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; - /** - * Delete a variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteVariable(siteId: string, variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - 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 - ); - } -} - -const Sites = SitesRuntime as unknown as { - new (client: Client<ServerAuth>): Sites; -}; - -export { Sites }; diff --git a/src/services/storage.ts b/src/services/storage.ts index 4a3f12d4..814b14b7 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,452 +1,17 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; -type StorageServerOnlyMethod = 'listBuckets' | 'createBucket' | 'getBucket' | 'updateBucket' | 'deleteBucket'; -type StorageClientOnlyMethod = never; +export class Storage { + client: Client; -export type Storage<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<StorageRuntime<TAuth>, 'client' | StorageServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<StorageRuntime<TAuth>, 'client' | StorageClientOnlyMethod> - : Omit<StorageRuntime<TAuth>, 'client'>; - -class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } - /** - * Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.BucketList>} - */ - listBuckets(this: Storage<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; - /** - * Get a list of all the storage buckets. 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.BucketList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listBuckets(this: Storage<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; - listBuckets( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.BucketList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/storage/buckets'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new storage bucket. - * - * @param {string} params.bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Bucket name - * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} params.transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - createBucket(this: Storage<ServerAuth>, params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; - /** - * Create a new storage bucket. - * - * @param {string} bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Bucket name - * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBucket(this: Storage<ServerAuth>, bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; - createBucket( - paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Bucket> { - let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - name: rest[0] as string, - permissions: rest[1] as string[], - fileSecurity: rest[2] as boolean, - enabled: rest[3] as boolean, - maximumFileSize: rest[4] as number, - allowedFileExtensions: rest[5] as string[], - compression: rest[6] as Compression, - encryption: rest[7] as boolean, - antivirus: rest[8] as boolean, - transformations: rest[9] as boolean - }; - } - - const bucketId = params.bucketId; - const name = params.name; - const permissions = params.permissions; - const fileSecurity = params.fileSecurity; - const enabled = params.enabled; - const maximumFileSize = params.maximumFileSize; - const allowedFileExtensions = params.allowedFileExtensions; - const compression = params.compression; - const encryption = params.encryption; - const antivirus = params.antivirus; - const transformations = params.transformations; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/storage/buckets'; - const payload: Payload = {}; - if (typeof bucketId !== 'undefined') { - payload['bucketId'] = bucketId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof compression !== 'undefined') { - payload['compression'] = compression; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. - * - * @param {string} params.bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - getBucket(this: Storage<ServerAuth>, params: { bucketId: string }): Promise<Models.Bucket>; - /** - * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. - * - * @param {string} bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getBucket(this: Storage<ServerAuth>, bucketId: string): Promise<Models.Bucket>; - getBucket( - paramsOrFirst: { bucketId: string } | string - ): Promise<Models.Bucket> { - let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string }; - } else { - params = { - bucketId: paramsOrFirst as string - }; - } - - const bucketId = params.bucketId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a storage bucket by its unique ID. - * - * @param {string} params.bucketId - Bucket unique ID. - * @param {string} params.name - Bucket name - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} params.transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - updateBucket(this: Storage<ServerAuth>, params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; - /** - * Update a storage bucket by its unique ID. - * - * @param {string} bucketId - Bucket unique ID. - * @param {string} name - Bucket name - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBucket(this: Storage<ServerAuth>, bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; - updateBucket( - paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Bucket> { - let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - name: rest[0] as string, - permissions: rest[1] as string[], - fileSecurity: rest[2] as boolean, - enabled: rest[3] as boolean, - maximumFileSize: rest[4] as number, - allowedFileExtensions: rest[5] as string[], - compression: rest[6] as Compression, - encryption: rest[7] as boolean, - antivirus: rest[8] as boolean, - transformations: rest[9] as boolean - }; - } - - const bucketId = params.bucketId; - const name = params.name; - const permissions = params.permissions; - const fileSecurity = params.fileSecurity; - const enabled = params.enabled; - const maximumFileSize = params.maximumFileSize; - const allowedFileExtensions = params.allowedFileExtensions; - const compression = params.compression; - const encryption = params.encryption; - const antivirus = params.antivirus; - const transformations = params.transformations; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof compression !== 'undefined') { - payload['compression'] = compression; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a storage bucket by its unique ID. - * - * @param {string} params.bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteBucket(this: Storage<ServerAuth>, params: { bucketId: string }): Promise<{}>; - /** - * Delete a storage bucket by its unique ID. - * - * @param {string} bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteBucket(this: Storage<ServerAuth>, bucketId: string): Promise<{}>; - deleteBucket( - paramsOrFirst: { bucketId: string } | string - ): Promise<{}> { - let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string }; - } else { - params = { - bucketId: paramsOrFirst as string - }; - } - - const bucketId = params.bucketId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -869,8 +434,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1014,8 +578,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1082,8 +645,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; + payload['project'] = this.client.config.project; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1092,9 +654,3 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server return uri.toString(); } } - -const Storage = StorageRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Storage<TAuth>; -}; - -export { Storage }; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 3e351951..fa671f14 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1,169 +1,15 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { RelationshipType } from '../enums/relationship-type'; -import { RelationMutate } from '../enums/relation-mutate'; -import { TablesDBIndexType } from '../enums/tables-db-index-type'; -import { OrderBy } from '../enums/order-by'; -type TablesDBServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listTables' | 'createTable' | 'getTable' | 'updateTable' | 'deleteTable' | 'listColumns' | 'createBigIntColumn' | 'updateBigIntColumn' | 'createBooleanColumn' | 'updateBooleanColumn' | 'createDatetimeColumn' | 'updateDatetimeColumn' | 'createEmailColumn' | 'updateEmailColumn' | 'createEnumColumn' | 'updateEnumColumn' | 'createFloatColumn' | 'updateFloatColumn' | 'createIntegerColumn' | 'updateIntegerColumn' | 'createIpColumn' | 'updateIpColumn' | 'createLineColumn' | 'updateLineColumn' | 'createLongtextColumn' | 'updateLongtextColumn' | 'createMediumtextColumn' | 'updateMediumtextColumn' | 'createPointColumn' | 'updatePointColumn' | 'createPolygonColumn' | 'updatePolygonColumn' | 'createRelationshipColumn' | 'createStringColumn' | 'updateStringColumn' | 'createTextColumn' | 'updateTextColumn' | 'createUrlColumn' | 'updateUrlColumn' | 'createVarcharColumn' | 'updateVarcharColumn' | 'getColumn' | 'deleteColumn' | 'updateRelationshipColumn' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex' | 'upsertRows' | 'updateRows' | 'deleteRows'; -type TablesDBClientOnlyMethod = never; +export class TablesDB { + client: Client; -export type TablesDB<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBClientOnlyMethod> - : Omit<TablesDBRuntime<TAuth>, 'client'>; - -class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter 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 columns: name - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - */ - list(this: TablesDB<ServerAuth>, params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter 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 columns: name - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(this: TablesDB<ServerAuth>, queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.DatabaseList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/tablesdb'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Database. - * - * - * @param {string} params.databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - create(this: TablesDB<ServerAuth>, params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Create a new Database. - * - * - * @param {string} databaseId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(this: TablesDB<ServerAuth>, databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; - create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/tablesdb'; - const payload: Payload = {}; - if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - /** * List transactions across all databases. * @@ -335,4999 +181,41 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve * @param {boolean} commit - Commit transaction? * @param {boolean} rollback - Rollback transaction? * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; - updateTransaction( - paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, - ...rest: [(boolean)?, (boolean)?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, commit?: boolean, rollback?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; - } else { - params = { - transactionId: paramsOrFirst as string, - commit: rest[0] as boolean, - rollback: rest[1] as boolean - }; - } - - const transactionId = params.transactionId; - const commit = params.commit; - const rollback = params.rollback; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof commit !== 'undefined') { - payload['commit'] = commit; - } - if (typeof rollback !== 'undefined') { - payload['rollback'] = rollback; - } - 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 transaction by its unique ID. - * - * @param {string} params.transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTransaction(params: { transactionId: string }): Promise<{}>; - /** - * Delete a transaction by its unique ID. - * - * @param {string} transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTransaction(transactionId: string): Promise<{}>; - deleteTransaction( - paramsOrFirst: { transactionId: string } | string - ): Promise<{}> { - let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string }; - } else { - params = { - transactionId: paramsOrFirst as string - }; - } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Create multiple operations in a single transaction. - * - * @param {string} params.transactionId - Transaction ID. - * @param {object[]} params.operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; - /** - * Create multiple operations in a single transaction. - * - * @param {string} transactionId - Transaction ID. - * @param {object[]} operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; - createOperations( - paramsOrFirst: { transactionId: string, operations?: object[] } | string, - ...rest: [(object[])?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, operations?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; - } else { - params = { - transactionId: paramsOrFirst as string, - operations: rest[0] as object[] - }; - } - - const transactionId = params.transactionId; - const operations = params.operations; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof operations !== 'undefined') { - payload['operations'] = operations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - get(this: TablesDB<ServerAuth>, params: { databaseId: string }): Promise<Models.Database>; - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(this: TablesDB<ServerAuth>, databaseId: string): Promise<Models.Database>; - get( - paramsOrFirst: { databaseId: string } | string - ): Promise<Models.Database> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a database by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - update(this: TablesDB<ServerAuth>, params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Update a database by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(this: TablesDB<ServerAuth>, databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; - update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(this: TablesDB<ServerAuth>, params: { databaseId: string }): Promise<{}>; - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(this: TablesDB<ServerAuth>, databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TableList>} - */ - listTables(this: TablesDB<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} databaseId - Database ID. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTables(this: TablesDB<ServerAuth>, databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; - listTables( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.TableList> { - let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Table name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {object[]} params.columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - createTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} name - Table name. Max length: 128 chars. - * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {object[]} columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; - createTable( - paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - rowSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - columns: rest[5] as object[], - indexes: rest[6] as object[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const name = params.name; - const permissions = params.permissions; - const rowSecurity = params.rowSecurity; - const enabled = params.enabled; - const columns = params.columns; - const indexes = params.indexes; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof tableId !== 'undefined') { - payload['tableId'] = tableId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof columns !== 'undefined') { - payload['columns'] = columns; - } - if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - getTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string }): Promise<Models.Table>; - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string): Promise<Models.Table>; - getTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a table by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.name - Table name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {boolean} params.purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - updateTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; - /** - * Update a table by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} name - Table name. Max length: 128 chars. - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {boolean} purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; - updateTable( - paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - rowSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - purge: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const name = params.name; - const permissions = params.permissions; - const rowSecurity = params.rowSecurity; - const enabled = params.enabled; - const purge = params.purge; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTable(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string }): Promise<{}>; - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTable(this: TablesDB<ServerAuth>, databaseId: string, tableId: string): Promise<{}>; - deleteTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - 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 columns in the table. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table 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 columns: key, type, size, required, array, status, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnList>} - */ - listColumns(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; - /** - * List columns in the table. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table 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 columns: key, type, size, required, array, status, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listColumns(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; - listColumns( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ColumnList> { - let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a bigint column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - */ - createBigIntColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; - /** - * Create a bigint column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBigIntColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; - createBigIntColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.ColumnBigint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a bigint column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - */ - updateBigIntColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; - /** - * Update a bigint column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBigIntColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; - updateBigIntColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.ColumnBigint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a boolean column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - */ - createBooleanColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; - /** - * Create a boolean column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBooleanColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; - createBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnBoolean> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a boolean column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - */ - updateBooleanColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; - /** - * Update a boolean column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBooleanColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; - updateBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.ColumnBoolean> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a date time column according to the ISO 8601 standard. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - */ - createDatetimeColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; - /** - * Create a date time column according to the ISO 8601 standard. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDatetimeColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; - createDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnDatetime> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a date time column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - */ - updateDatetimeColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; - /** - * Update a date time column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDatetimeColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; - updateDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnDatetime> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an email column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - */ - createEmailColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; - /** - * Create an email column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; - createEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnEmail> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an email column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - */ - updateEmailColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; - /** - * Update an email column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; - updateEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnEmail> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {string[]} params.elements - Array of enum values. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - */ - createEnumColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; - /** - * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {string[]} elements - Array of enum values. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEnumColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; - createEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnEnum> { - let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an enum column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {string[]} params.elements - Updated list of enum values. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - */ - updateEnumColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; - /** - * Update an enum column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {string[]} elements - Updated list of enum values. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEnumColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; - updateEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnEnum> { - let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a float column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - */ - createFloatColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; - /** - * Create a float column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFloatColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; - createFloatColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] - ): Promise<Models.ColumnFloat> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a float column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - */ - updateFloatColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; - /** - * Update a float column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFloatColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; - updateFloatColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.ColumnFloat> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create an integer column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - */ - createIntegerColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; - /** - * Create an integer column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIntegerColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; - createIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.ColumnInteger> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an integer column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - */ - updateIntegerColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; - /** - * Update an integer column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIntegerColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; - updateIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.ColumnInteger> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create IP address column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - */ - createIpColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; - /** - * Create IP address column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIpColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; - createIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnIp> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an ip column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - */ - updateIpColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; - /** - * Update an ip column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIpColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; - updateIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnIp> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric line column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - */ - createLineColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; - /** - * Create a geometric line column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLineColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; - createLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnLine> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a line column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - */ - updateLineColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; - /** - * Update a line column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLineColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; - updateLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnLine> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a longtext column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - */ - createLongtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; - /** - * Create a longtext column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLongtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; - createLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnLongtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a longtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - */ - updateLongtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; - /** - * Update a longtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLongtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; - updateLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnLongtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a mediumtext column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - */ - createMediumtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; - /** - * Create a mediumtext column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMediumtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; - createMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnMediumtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a mediumtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - */ - updateMediumtextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; - /** - * Update a mediumtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMediumtextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; - updateMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnMediumtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric point column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - */ - createPointColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; - /** - * Create a geometric point column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPointColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; - createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnPoint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a point column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - */ - updatePointColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; - /** - * Update a point column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePointColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; - updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnPoint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a geometric polygon column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - */ - createPolygonColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; - /** - * Create a geometric polygon column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolygonColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; - createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnPolygon> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a polygon column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - */ - updatePolygonColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; - /** - * Update a polygon column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolygonColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; - updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnPolygon> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.relatedTableId - Related Table ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? - * @param {string} params.key - Column Key. - * @param {string} params.twoWayKey - Two Way Column Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - */ - createRelationshipColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; - /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} relatedTableId - Related Table ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? - * @param {string} key - Column Key. - * @param {string} twoWayKey - Two Way Column Key. - * @param {RelationMutate} onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRelationshipColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; - createRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise<Models.ColumnRelationship> { - let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - relatedTableId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const relatedTableId = params.relatedTableId; - const type = params.type; - const twoWay = params.twoWay; - const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof relatedTableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedTableId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof relatedTableId !== 'undefined') { - payload['relatedTableId'] = relatedTableId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; - } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a string column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {number} params.size - Column size for text columns, in number of characters. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. - */ - createStringColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; - /** - * Create a string column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {number} size - Column size for text columns, in number of characters. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createStringColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; - createStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a string column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} params.size - Maximum size of the string column. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. - */ - updateStringColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; - /** - * Update a string column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} size - Maximum size of the string column. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStringColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; - updateStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a text column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - */ - createTextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; - /** - * Create a text column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; - createTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnText> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a text column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - */ - updateTextColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; - /** - * Update a text column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; - updateTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnText> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a URL column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - */ - createUrlColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; - /** - * Create a URL column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createUrlColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; - createUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnUrl> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an url column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - */ - updateUrlColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; - /** - * Update an url column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUrlColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; - updateUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnUrl> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a varchar column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {number} params.size - Column size for varchar columns, in number of characters. Maximum size is 16381. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - */ - createVarcharColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; - /** - * Create a varchar column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {number} size - Column size for varchar columns, in number of characters. Maximum size is 16381. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVarcharColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; - createVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnVarchar> { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a varchar column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} params.size - Maximum size of the varchar column. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - */ - updateVarcharColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; - /** - * Update a varchar column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} size - Maximum size of the varchar column. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVarcharColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; - updateVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.ColumnVarchar> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get column by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} - */ - getColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; - /** - * Get column by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; - getColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - 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 - ); - } - - /** - * Deletes a column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<{}>; - /** - * Deletes a column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<{}>; - deleteColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - */ - updateRelationshipColumn(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipColumn(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; - updateRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise<Models.ColumnRelationship> { - let params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * List indexes on the table. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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 columns: key, type, status, attributes, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndexList>} - */ - listIndexes(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; - /** - * List indexes on the table. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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 columns: key, type, status, attributes, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndexList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIndexes(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; - listIndexes( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ColumnIndexList> { - let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - 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 - ); - } - - /** - * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. - * Type can be `key`, `fulltext`, or `unique`. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @param {TablesDBIndexType} params.type - Index type. - * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} params.lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - */ - createIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; - /** - * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. - * Type can be `key`, `fulltext`, or `unique`. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @param {TablesDBIndexType} type - Index type. - * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; - createIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] - ): Promise<Models.ColumnIndex> { - let params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - type: rest[2] as TablesDBIndexType, - columns: rest[3] as string[], - orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const type = params.type; - const columns = params.columns; - const orders = params.orders; - const lengths = params.lengths; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof columns === 'undefined') { - throw new AppwriteException('Missing required parameter: "columns"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof columns !== 'undefined') { - payload['columns'] = columns; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get index by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - */ - getIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; - /** - * Get index by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; - getIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ColumnIndex> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - 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 index. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<{}>; - /** - * Delete an index. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIndex(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, key: string): Promise<{}>; - deleteIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; - listRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const transactionId = params.transactionId; - const total = params.total; - const ttl = params.ttl; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - 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 - ); - } - - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} params.rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON 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 {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} + * @returns {Promise<Models.Transaction>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; - createRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; + updateTransaction( + paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, + ...rest: [(boolean)?, (boolean)?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, commit?: boolean, rollback?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, - permissions: rest[3] as string[], - transactionId: rest[4] as string + transactionId: paramsOrFirst as string, + commit: rest[0] as boolean, + rollback: rest[1] as boolean }; } - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; const transactionId = params.transactionId; + const commit = params.commit; + const rollback = params.rollback; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); const payload: Payload = {}; - if (typeof rowId !== 'undefined') { - payload['rowId'] = rowId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + if (typeof commit !== 'undefined') { + payload['commit'] = commit; } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof rollback !== 'undefined') { + payload['rollback'] = rollback; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -5336,7 +224,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload @@ -5344,68 +232,43 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * Delete a transaction by its unique ID. * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {object[]} params.rows - Array of rows data as JSON objects. - * @param {string} params.transactionId - Transaction ID for staging the operation. + * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<{}>} */ - createRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + deleteTransaction(params: { transactionId: string }): Promise<{}>; /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * Delete a transaction by its unique ID. * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {object[]} rows - Array of rows data as JSON objects. - * @param {string} transactionId - Transaction ID for staging the operation. + * @param {string} transactionId - Transaction ID. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; - createRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + deleteTransaction(transactionId: string): Promise<{}>; + deleteTransaction( + paramsOrFirst: { transactionId: string } | string + ): Promise<{}> { + let params: { transactionId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string + transactionId: paramsOrFirst as string }; } - const databaseId = params.databaseId; - const tableId = params.tableId; - const rows = params.rows; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rows === 'undefined') { - throw new AppwriteException('Missing required parameter: "rows"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -5413,7 +276,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } return this.client.call( - 'post', + 'delete', uri, apiHeaders, payload @@ -5421,69 +284,50 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * + * Create multiple operations in a single transaction. * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {object[]} params.rows - Array of row data as JSON objects. May contain partial rows. - * @param {string} params.transactionId - Transaction ID for staging the operation. + * @param {string} params.transactionId - Transaction ID. + * @param {object[]} params.operations - Array of staged operations. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Transaction>} */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * + * Create multiple operations in a single transaction. * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {object[]} rows - Array of row data as JSON objects. May contain partial rows. - * @param {string} transactionId - Transaction ID for staging the operation. + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Transaction>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; - upsertRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; + createOperations( + paramsOrFirst: { transactionId: string, operations?: object[] } | string, + ...rest: [(object[])?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, operations?: object[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string + transactionId: paramsOrFirst as string, + operations: rest[0] as object[] }; } - const databaseId = params.databaseId; - const tableId = params.tableId; - const rows = params.rows; const transactionId = params.transactionId; + const operations = params.operations; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rows === 'undefined') { - throw new AppwriteException('Missing required parameter: "rows"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof operations !== 'undefined') { + payload['operations'] = operations; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -5492,7 +336,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } return this.client.call( - 'put', + 'post', uri, apiHeaders, payload @@ -5500,53 +344,57 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {object} params.data - Row data as JSON object. Include only column and value pairs to be updated. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} params.transactionId - Transaction ID for staging the operation. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise<Models.RowList<Row>>} */ - updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {object} data - Row data as JSON object. Include only column and value pairs to be updated. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - * @param {string} transactionId - Transaction ID for staging the operation. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise<Models.RowList<Row>>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; - updateRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] + listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; + listRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, - data: rest[1] as object, - queries: rest[2] as string[], - transactionId: rest[3] as string + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number }; } const databaseId = params.databaseId; const tableId = params.tableId; - const data = params.data; const queries = params.queries; const transactionId = params.transactionId; + const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -5557,23 +405,25 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } if (typeof queries !== 'undefined') { payload['queries'] = queries; } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; } + 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 } = { - 'content-type': 'application/json', } return this.client.call( - 'patch', + 'get', uri, apiHeaders, payload @@ -5581,48 +431,56 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} params.rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON 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 {string} params.transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Row>} */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. * * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} rowId - Row 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 {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON 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 {string} transactionId - Transaction ID for staging the operation. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Row>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; - deleteRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; + createRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string + rowId: rest[1] as string, + data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, + permissions: rest[3] as string[], + transactionId: rest[4] as string }; } const databaseId = params.databaseId; const tableId = params.tableId; - const queries = params.queries; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5631,11 +489,23 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve if (typeof tableId === 'undefined') { throw new AppwriteException('Missing required parameter: "tableId"'); } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; + if (typeof rowId !== 'undefined') { + payload['rowId'] = rowId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -5647,7 +517,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } return this.client.call( - 'delete', + 'post', uri, apiHeaders, payload @@ -6174,9 +1044,3 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve ); } } - -const TablesDB = TablesDBRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): TablesDB<TAuth>; -}; - -export { TablesDB }; diff --git a/src/services/teams.ts b/src/services/teams.ts index cdcf75ca..870f8a5b 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type TeamsServerOnlyMethod = never; -type TeamsClientOnlyMethod = never; +export class Teams { + client: Client; -export type Teams<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsClientOnlyMethod> - : Omit<TeamsRuntime<TAuth>, 'client'>; - -class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -900,9 +891,3 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu ); } } - -const Teams = TeamsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Teams<TAuth>; -}; - -export { Teams }; diff --git a/src/services/tokens.ts b/src/services/tokens.ts deleted file mode 100644 index eb904d5c..00000000 --- a/src/services/tokens.ts +++ /dev/null @@ -1,322 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Tokens = Omit<TokensRuntime, 'client'>; - -class TokensRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File unique ID. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceTokenList>} - */ - list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise<Models.ResourceTokenList>; - /** - * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File unique ID. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceTokenList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>; - list( - paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ResourceTokenList> { - let params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[], total?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const queries = params.queries; - const total = params.total; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File unique ID. - * @param {string} params.expire - Token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>; - /** - * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File unique ID. - * @param {string} expire - Token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>; - createFileToken( - paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ResourceToken> { - let params: { bucketId: string, fileId: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - expire: rest[1] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const expire = params.expire; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a token by its unique ID. - * - * @param {string} params.tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - get(params: { tokenId: string }): Promise<Models.ResourceToken>; - /** - * Get a token by its unique ID. - * - * @param {string} tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(tokenId: string): Promise<Models.ResourceToken>; - get( - paramsOrFirst: { tokenId: string } | string - ): Promise<Models.ResourceToken> { - let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string }; - } else { - params = { - tokenId: paramsOrFirst as string - }; - } - - const tokenId = params.tokenId; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a token by its unique ID. Use this endpoint to update a token's expiry date. - * - * @param {string} params.tokenId - Token unique ID. - * @param {string} params.expire - File token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>; - /** - * Update a token by its unique ID. Use this endpoint to update a token's expiry date. - * - * @param {string} tokenId - Token unique ID. - * @param {string} expire - File token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(tokenId: string, expire?: string): Promise<Models.ResourceToken>; - update( - paramsOrFirst: { tokenId: string, expire?: string } | string, - ...rest: [(string)?] - ): Promise<Models.ResourceToken> { - let params: { tokenId: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string, expire?: string }; - } else { - params = { - tokenId: paramsOrFirst as string, - expire: rest[0] as string - }; - } - - const tokenId = params.tokenId; - const expire = params.expire; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - const payload: Payload = {}; - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a token by its unique ID. - * - * @param {string} params.tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { tokenId: string }): Promise<{}>; - /** - * Delete a token by its unique ID. - * - * @param {string} tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(tokenId: string): Promise<{}>; - delete( - paramsOrFirst: { tokenId: string } | string - ): Promise<{}> { - let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string }; - } else { - params = { - tokenId: paramsOrFirst as string - }; - } - - const tokenId = params.tokenId; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - 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 - ); - } -} - -const Tokens = TokensRuntime as unknown as { - new (client: Client<ServerAuth>): Tokens; -}; - -export { Tokens }; diff --git a/src/services/users.ts b/src/services/users.ts deleted file mode 100644 index 46e89596..00000000 --- a/src/services/users.ts +++ /dev/null @@ -1,3277 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { PasswordHash } from '../enums/password-hash'; -import { AuthenticatorType } from '../enums/authenticator-type'; -import { MessagingProviderType } from '../enums/messaging-provider-type'; - -export type Users = Omit<UsersRuntime, 'client'>; - -class UsersRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Get a list of all the project's users. You can use the query params to filter your results. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UserList<Preferences>>} - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.UserList<Preferences>>; - /** - * Get a list of all the project's users. You can use the query params to filter your results. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UserList<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.UserList<Preferences>>; - list<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.UserList<Preferences>> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/users'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.password - Plain text user password. Must be at least 8 chars. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. - * - * @param {string} userId - User 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} email - User email. - * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} password - Plain text user password. Must be at least 8 chars. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>>; - create<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email?: string, phone?: string, password?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email?: string, phone?: string, password?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email?: string, phone?: string, password?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - phone: rest[1] as string, - password: rest[2] as string, - name: rest[3] as string - }; - } - - const userId = params.userId; - const email = params.email; - const phone = params.phone; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof phone !== 'undefined') { - payload['phone'] = phone; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using Argon2. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using Argon2. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/argon2'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using Bcrypt. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using Bcrypt. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/bcrypt'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get identities for all users. - * - * @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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - */ - listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.IdentityList>; - /** - * Get identities for all users. - * - * @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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIdentities(queries?: string[], search?: string, total?: boolean): Promise<Models.IdentityList>; - listIdentities( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.IdentityList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/users/identities'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - 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 - ); - } - - /** - * Delete an identity by its unique ID. - * - * @param {string} params.identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIdentity(params: { identityId: string }): Promise<{}>; - /** - * Delete an identity by its unique ID. - * - * @param {string} identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIdentity(identityId: string): Promise<{}>; - deleteIdentity( - paramsOrFirst: { identityId: string } | string - ): Promise<{}> { - let params: { identityId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { identityId: string }; - } else { - params = { - identityId: paramsOrFirst as string - }; - } - - const identityId = params.identityId; - - if (typeof identityId === 'undefined') { - throw new AppwriteException('Missing required parameter: "identityId"'); - } - - const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using MD5. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using MD5. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/md5'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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.email - User email. - * @param {string} params.password - User password hashed using PHPass. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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} email - User email. - * @param {string} password - User password hashed using PHPass. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/phpass'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using Scrypt. - * @param {string} params.passwordSalt - Optional salt used to hash password. - * @param {number} params.passwordCpu - Optional CPU cost used to hash password. - * @param {number} params.passwordMemory - Optional memory cost used to hash password. - * @param {number} params.passwordParallel - Optional parallelization cost used to hash password. - * @param {number} params.passwordLength - Optional hash length used to hash password. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using Scrypt. - * @param {string} passwordSalt - Optional salt used to hash password. - * @param {number} passwordCpu - Optional CPU cost used to hash password. - * @param {number} passwordMemory - Optional memory cost used to hash password. - * @param {number} passwordParallel - Optional parallelization cost used to hash password. - * @param {number} passwordLength - Optional hash length used to hash password. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>; - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordSalt: rest[2] as string, - passwordCpu: rest[3] as number, - passwordMemory: rest[4] as number, - passwordParallel: rest[5] as number, - passwordLength: rest[6] as number, - name: rest[7] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordSalt = params.passwordSalt; - const passwordCpu = params.passwordCpu; - const passwordMemory = params.passwordMemory; - const passwordParallel = params.passwordParallel; - const passwordLength = params.passwordLength; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (typeof passwordCpu === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordCpu"'); - } - if (typeof passwordMemory === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordMemory"'); - } - if (typeof passwordParallel === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordParallel"'); - } - if (typeof passwordLength === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordLength"'); - } - - const apiPath = '/users/scrypt'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; - } - if (typeof passwordCpu !== 'undefined') { - payload['passwordCpu'] = passwordCpu; - } - if (typeof passwordMemory !== 'undefined') { - payload['passwordMemory'] = passwordMemory; - } - if (typeof passwordParallel !== 'undefined') { - payload['passwordParallel'] = passwordParallel; - } - if (typeof passwordLength !== 'undefined') { - payload['passwordLength'] = passwordLength; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using Scrypt Modified. - * @param {string} params.passwordSalt - Salt used to hash password. - * @param {string} params.passwordSaltSeparator - Salt separator used to hash password. - * @param {string} params.passwordSignerKey - Signer key used to hash password. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using Scrypt Modified. - * @param {string} passwordSalt - Salt used to hash password. - * @param {string} passwordSaltSeparator - Salt separator used to hash password. - * @param {string} passwordSignerKey - Signer key used to hash password. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>>; - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordSalt: rest[2] as string, - passwordSaltSeparator: rest[3] as string, - passwordSignerKey: rest[4] as string, - name: rest[5] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordSalt = params.passwordSalt; - const passwordSaltSeparator = params.passwordSaltSeparator; - const passwordSignerKey = params.passwordSignerKey; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (typeof passwordSaltSeparator === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); - } - if (typeof passwordSignerKey === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); - } - - const apiPath = '/users/scrypt-modified'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; - } - if (typeof passwordSaltSeparator !== 'undefined') { - payload['passwordSaltSeparator'] = passwordSaltSeparator; - } - if (typeof passwordSignerKey !== 'undefined') { - payload['passwordSignerKey'] = passwordSignerKey; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User 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.email - User email. - * @param {string} params.password - User password hashed using SHA. - * @param {PasswordHash} params.passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User 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} email - User email. - * @param {string} password - User password hashed using SHA. - * @param {PasswordHash} passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise<Models.User<Preferences>>; - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string } | string, - ...rest: [(string)?, (string)?, (PasswordHash)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordVersion: rest[2] as PasswordHash, - name: rest[3] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordVersion = params.passwordVersion; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/sha'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordVersion !== 'undefined') { - payload['passwordVersion'] = passwordVersion; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a user by its unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Models.User<Preferences>>; - /** - * Get a user by its unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Models.User<Preferences>>; - get<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string } | string - ): Promise<Models.User<Preferences>> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}'.replace('{userId}', userId); - 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 user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { userId: string }): Promise<{}>; - /** - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(userId: string): Promise<{}>; - delete( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user email by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.email - User email. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string }): Promise<Models.User<Preferences>>; - /** - * Update the user email by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} email - User email. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>; - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string - }; - } - - const userId = params.userId; - const email = params.email; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - - const apiPath = '/users/{userId}/email'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - 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 - ); - } - - /** - * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. - * - * - * @param {string} params.userId - User ID. - * @param {boolean} params.impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, impersonator: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. - * - * - * @param {string} userId - User ID. - * @param {boolean} impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>; - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, impersonator: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, impersonator: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - impersonator: rest[0] as boolean - }; - } - - const userId = params.userId; - const impersonator = params.impersonator; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof impersonator === 'undefined') { - throw new AppwriteException('Missing required parameter: "impersonator"'); - } - - const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof impersonator !== 'undefined') { - payload['impersonator'] = impersonator; - } - 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 - ); - } - - /** - * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - * - * @param {string} params.userId - User ID. - * @param {string} params.sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. - * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - */ - createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise<Models.Jwt>; - /** - * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - * - * @param {string} userId - User ID. - * @param {string} sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. - * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt>; - createJWT( - paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string, - ...rest: [(string)?, (number)?] - ): Promise<Models.Jwt> { - let params: { userId: string, sessionId?: string, duration?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number }; - } else { - params = { - userId: paramsOrFirst as string, - sessionId: rest[0] as string, - duration: rest[1] as number - }; - } - - const userId = params.userId; - const sessionId = params.sessionId; - const duration = params.duration; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof sessionId !== 'undefined') { - payload['sessionId'] = sessionId; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user labels by its unique ID. - * - * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. - * - * @param {string} params.userId - User ID. - * @param {string[]} params.labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, labels: string[] }): Promise<Models.User<Preferences>>; - /** - * Update the user labels by its unique ID. - * - * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. - * - * @param {string} userId - User ID. - * @param {string[]} labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>>; - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, labels: string[] } | string, - ...rest: [(string[])?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, labels: string[] }; - } else { - params = { - userId: paramsOrFirst as string, - labels: rest[0] as string[] - }; - } - - const userId = params.userId; - const labels = params.labels; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); - } - - const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof labels !== 'undefined') { - payload['labels'] = labels; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the user activity logs list by its unique ID. - * - * @param {string} params.userId - User 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). Only supported methods are limit and offset - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the user activity logs list by its unique ID. - * - * @param {string} userId - User 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). Only supported methods are limit and offset - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listLogs(userId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listLogs( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { userId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); - 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 the user membership list by its unique ID. - * - * @param {string} params.userId - User 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: userId, teamId, invited, joined, confirm, roles - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - */ - listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; - /** - * Get the user membership list by its unique ID. - * - * @param {string} userId - User 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: userId, teamId, invited, joined, confirm, roles - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; - listMemberships( - paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.MembershipList> { - let params: { userId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - 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 - ); - } - - /** - * Enable or disable MFA on a user account. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. - */ - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable MFA on a user account. - * - * @param {string} userId - User ID. - * @param {boolean} mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - mfa: rest[0] as boolean - }; - } - - const userId = params.userId; - const mfa = params.mfa; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof mfa === 'undefined') { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; - } - 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 - ); - } - - /** - * Enable or disable MFA on a user account. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable MFA on a user account. - * - * @param {string} userId - User ID. - * @param {boolean} mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - mfa: rest[0] as boolean - }; - } - - const userId = params.userId; - const mfa = params.mfa; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof mfa === 'undefined') { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; - } - 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 an authenticator app. - * - * @param {string} params.userId - User ID. - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. - */ - deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator app. - * - * @param {string} userId - User ID. - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; - deleteMfaAuthenticator( - paramsOrFirst: { userId: string, type: AuthenticatorType } | string, - ...rest: [(AuthenticatorType)?] - ): Promise<{}> { - let params: { userId: string, type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; - } else { - params = { - userId: paramsOrFirst as string, - type: rest[0] as AuthenticatorType - }; - } - - const userId = params.userId; - const type = params.type; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); - 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 - ); - } - - /** - * Delete an authenticator app. - * - * @param {string} params.userId - User ID. - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator app. - * - * @param {string} userId - User ID. - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMFAAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; - deleteMFAAuthenticator( - paramsOrFirst: { userId: string, type: AuthenticatorType } | string, - ...rest: [(AuthenticatorType)?] - ): Promise<{}> { - let params: { userId: string, type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; - } else { - params = { - userId: paramsOrFirst as string, - type: rest[0] as AuthenticatorType - }; - } - - const userId = params.userId; - const type = params.type; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); - 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 factors available on the account to be used as a MFA challange. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead. - */ - listMfaFactors(params: { userId: string }): Promise<Models.MfaFactors>; - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMfaFactors(userId: string): Promise<Models.MfaFactors>; - listMfaFactors( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaFactors> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); - 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 - ); - } - - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - */ - listMFAFactors(params: { userId: string }): Promise<Models.MfaFactors>; - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMFAFactors(userId: string): Promise<Models.MfaFactors>; - listMFAFactors( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaFactors> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); - 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 - ); - } - - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. - */ - getMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - getMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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 - ); - } - - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - getMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - getMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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 - ); - } - - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. - */ - updateMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - updateMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - updateMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - updateMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. - */ - createMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - createMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - createMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - createMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - 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( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user name by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, name: string }): Promise<Models.User<Preferences>>; - /** - * Update the user name by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, name: string): Promise<Models.User<Preferences>>; - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, name: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, name: string }; - } else { - params = { - userId: paramsOrFirst as string, - name: rest[0] as string - }; - } - - const userId = params.userId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/users/{userId}/name'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user password by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.password - New user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, password: string }): Promise<Models.User<Preferences>>; - /** - * Update the user password by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} password - New user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, password: string): Promise<Models.User<Preferences>>; - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, password: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, password: string }; - } else { - params = { - userId: paramsOrFirst as string, - password: rest[0] as string - }; - } - - const userId = params.userId; - const password = params.password; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/{userId}/password'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user phone by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.number - User phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, number: string }): Promise<Models.User<Preferences>>; - /** - * Update the user phone by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} number - User phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, number: string): Promise<Models.User<Preferences>>; - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, number: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, number: string }; - } else { - params = { - userId: paramsOrFirst as string, - number: rest[0] as string - }; - } - - const userId = params.userId; - const number = params.number; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the user preferences by its unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Preferences>; - /** - * Get the user preferences by its unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Preferences>; - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string } | string - ): Promise<Preferences> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - * - * @param {string} params.userId - User ID. - * @param {object} params.prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, prefs: object }): Promise<Preferences>; - /** - * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - * - * @param {string} userId - User ID. - * @param {object} prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, prefs: object): Promise<Preferences>; - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, prefs: object } | string, - ...rest: [(object)?] - ): Promise<Preferences> { - let params: { userId: string, prefs: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, prefs: object }; - } else { - params = { - userId: paramsOrFirst as string, - prefs: rest[0] as object - }; - } - - const userId = params.userId; - const prefs = params.prefs; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Get the user sessions list by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SessionList>} - */ - listSessions(params: { userId: string, total?: boolean }): Promise<Models.SessionList>; - /** - * Get the user sessions list by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SessionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSessions(userId: string, total?: boolean): Promise<Models.SessionList>; - listSessions( - paramsOrFirst: { userId: string, total?: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.SessionList> { - let params: { userId: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - total: rest[0] as boolean - }; - } - - const userId = params.userId; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Creates a session for a user. Returns an immediately usable session object. - * - * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. - * - * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - createSession(params: { userId: string }): Promise<Models.Session>; - /** - * Creates a session for a user. Returns an immediately usable session object. - * - * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. - * - * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSession(userId: string): Promise<Models.Session>; - createSession( - paramsOrFirst: { userId: string } | string - ): Promise<Models.Session> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - 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( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete all user's sessions by using the user's unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSessions(params: { userId: string }): Promise<{}>; - /** - * Delete all user's sessions by using the user's unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSessions(userId: string): Promise<{}>; - deleteSessions( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - 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 - ); - } - - /** - * Delete a user sessions by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.sessionId - Session ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; - /** - * Delete a user sessions by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} sessionId - Session ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSession(userId: string, sessionId: string): Promise<{}>; - deleteSession( - paramsOrFirst: { userId: string, sessionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { userId: string, sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, sessionId: string }; - } else { - params = { - userId: paramsOrFirst as string, - sessionId: rest[0] as string - }; - } - - const userId = params.userId; - const sessionId = params.sessionId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - - const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.status - User Status. To activate the user pass `true` and to block the user pass `false`. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, status: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. - * - * @param {string} userId - User ID. - * @param {boolean} status - User Status. To activate the user pass `true` and to block the user pass `false`. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>; - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, status: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, status: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - status: rest[0] as boolean - }; - } - - const userId = params.userId; - const status = params.status; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/users/{userId}/status'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * List the messaging targets that are associated with a user. - * - * @param {string} params.userId - User 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: userId, providerId, identifier, providerType - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - */ - listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; - /** - * List the messaging targets that are associated with a user. - * - * @param {string} userId - User 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: userId, providerId, identifier, providerType - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTargets(userId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; - listTargets( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.TargetList> { - let params: { userId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a messaging target. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target 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 {MessagingProviderType} params.providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. - * @param {string} params.identifier - The target identifier (token, email, phone etc.) - * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise<Models.Target>; - /** - * Create a messaging target. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target 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 {MessagingProviderType} providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. - * @param {string} identifier - The target identifier (token, email, phone etc.) - * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise<Models.Target>; - createTarget( - paramsOrFirst: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (MessagingProviderType)?, (string)?, (string)?, (string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string, - providerType: rest[1] as MessagingProviderType, - identifier: rest[2] as string, - providerId: rest[3] as string, - name: rest[4] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - const providerType = params.providerType; - const identifier = params.identifier; - const providerId = params.providerId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (typeof providerType === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerType"'); - } - if (typeof identifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "identifier"'); - } - - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; - } - if (typeof providerType !== 'undefined') { - payload['providerType'] = providerType; - } - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a user's push notification target by ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - getTarget(params: { userId: string, targetId: string }): Promise<Models.Target>; - /** - * Get a user's push notification target by ID. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTarget(userId: string, targetId: string): Promise<Models.Target>; - getTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a messaging target. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @param {string} params.identifier - The target identifier (token, email, phone etc.) - * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise<Models.Target>; - /** - * Update a messaging target. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @param {string} identifier - The target identifier (token, email, phone etc.) - * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. - * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target>; - updateTarget( - paramsOrFirst: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string, - identifier: rest[1] as string, - providerId: rest[2] as string, - name: rest[3] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - const identifier = params.identifier; - const providerId = params.providerId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - const payload: Payload = {}; - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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 messaging target. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; - /** - * Delete a messaging target. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTarget(userId: string, targetId: string): Promise<{}>; - deleteTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { userId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - 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 - ); - } - - /** - * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - * - * - * @param {string} params.userId - User ID. - * @param {number} params.length - Token length in characters. The default length is 6 characters - * @param {number} params.expire - Token expiration period in seconds. The default expiration is 15 minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createToken(params: { userId: string, length?: number, expire?: number }): Promise<Models.Token>; - /** - * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - * - * - * @param {string} userId - User ID. - * @param {number} length - Token length in characters. The default length is 6 characters - * @param {number} expire - Token expiration period in seconds. The default expiration is 15 minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createToken(userId: string, length?: number, expire?: number): Promise<Models.Token>; - createToken( - paramsOrFirst: { userId: string, length?: number, expire?: number } | string, - ...rest: [(number)?, (number)?] - ): Promise<Models.Token> { - let params: { userId: string, length?: number, expire?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, length?: number, expire?: number }; - } else { - params = { - userId: paramsOrFirst as string, - length: rest[0] as number, - expire: rest[1] as number - }; - } - - const userId = params.userId; - const length = params.length; - const expire = params.expire; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof length !== 'undefined') { - payload['length'] = length; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user email verification status by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.emailVerification - User email verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, emailVerification: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user email verification status by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} emailVerification - User email verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>; - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, emailVerification: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, emailVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, emailVerification: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - emailVerification: rest[0] as boolean - }; - } - - const userId = params.userId; - const emailVerification = params.emailVerification; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof emailVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "emailVerification"'); - } - - const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof emailVerification !== 'undefined') { - payload['emailVerification'] = emailVerification; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the user phone verification status by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.phoneVerification - User phone verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, phoneVerification: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user phone verification status by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} phoneVerification - User phone verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>; - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, phoneVerification: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, phoneVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, phoneVerification: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - phoneVerification: rest[0] as boolean - }; - } - - const userId = params.userId; - const phoneVerification = params.phoneVerification; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof phoneVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "phoneVerification"'); - } - - const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof phoneVerification !== 'undefined') { - payload['phoneVerification'] = phoneVerification; - } - 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 - ); - } -} - -const Users = UsersRuntime as unknown as { - new (client: Client<ServerAuth>): Users; -}; - -export { Users }; diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts deleted file mode 100644 index 4347018b..00000000 --- a/src/services/webhooks.ts +++ /dev/null @@ -1,473 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Webhooks = Omit<WebhooksRuntime, 'client'>; - -class WebhooksRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - this.client = client; - } - - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.WebhookList>} - */ - list(params?: { queries?: string[], total?: boolean }): Promise<Models.WebhookList>; - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, authUsername, tls, events, enabled, logs, attempts - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.WebhookList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], total?: boolean): Promise<Models.WebhookList>; - list( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.WebhookList> { - 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 = '/webhooks'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} params.webhookId - Webhook 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.url - Webhook URL. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. - * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. - * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }): Promise<Models.Webhook>; - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} webhookId - Webhook 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} url - Webhook URL. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. - * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. - * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string): Promise<Models.Webhook>; - create( - paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - url: rest[0] as string, - name: rest[1] as string, - events: rest[2] as string[], - enabled: rest[3] as boolean, - tls: rest[4] as boolean, - authUsername: rest[5] as string, - authPassword: rest[6] as string, - secret: rest[7] as string - }; - } - - const webhookId = params.webhookId; - const url = params.url; - const name = params.name; - const events = params.events; - const enabled = params.enabled; - const tls = params.tls; - const authUsername = params.authUsername; - const authPassword = params.authPassword; - const secret = params.secret; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - - const apiPath = '/webhooks'; - const payload: Payload = {}; - if (typeof webhookId !== 'undefined') { - payload['webhookId'] = webhookId; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof tls !== 'undefined') { - payload['tls'] = tls; - } - if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; - } - if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} params.webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - get(params: { webhookId: string }): Promise<Models.Webhook>; - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(webhookId: string): Promise<Models.Webhook>; - get( - paramsOrFirst: { webhookId: string } | string - ): Promise<Models.Webhook> { - let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string }; - } else { - params = { - webhookId: paramsOrFirst as string - }; - } - - const webhookId = params.webhookId; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} params.webhookId - Webhook ID. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string} params.url - Webhook URL. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. - * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise<Models.Webhook>; - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} webhookId - Webhook ID. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string} url - Webhook URL. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. - * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise<Models.Webhook>; - update( - paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - name: rest[0] as string, - url: rest[1] as string, - events: rest[2] as string[], - enabled: rest[3] as boolean, - tls: rest[4] as boolean, - authUsername: rest[5] as string, - authPassword: rest[6] as string - }; - } - - const webhookId = params.webhookId; - const name = params.name; - const url = params.url; - const events = params.events; - const enabled = params.enabled; - const tls = params.tls; - const authUsername = params.authUsername; - const authPassword = params.authPassword; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof tls !== 'undefined') { - payload['tls'] = tls; - } - if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; - } - if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} params.webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { webhookId: string }): Promise<{}>; - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(webhookId: string): Promise<{}>; - delete( - paramsOrFirst: { webhookId: string } | string - ): Promise<{}> { - let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string }; - } else { - params = { - webhookId: paramsOrFirst as string - }; - } - - const webhookId = params.webhookId; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} params.webhookId - Webhook ID. - * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - updateSecret(params: { webhookId: string, secret?: string }): Promise<Models.Webhook>; - /** - * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} webhookId - Webhook ID. - * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSecret(webhookId: string, secret?: string): Promise<Models.Webhook>; - updateSecret( - paramsOrFirst: { webhookId: string, secret?: string } | string, - ...rest: [(string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, secret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, secret?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const webhookId = params.webhookId; - const secret = params.secret; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - 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 - ); - } -} - -const Webhooks = WebhooksRuntime as unknown as { - new (client: Client<ServerAuth>): Webhooks; -}; - -export { Webhooks }; From 61a084bf65b50f87bc30fed65e5a4a292a3591ea Mon Sep 17 00:00:00 2001 From: root <arnabchatterjee.ac.2@gmail.com> Date: Mon, 18 May 2026 13:37:01 +0000 Subject: [PATCH 5/5] chore: update Web SDK to 25.1.0 --- src/services/realtime.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/realtime.ts b/src/services/realtime.ts index 8e34310b..7aebdaa6 100644 --- a/src/services/realtime.ts +++ b/src/services/realtime.ts @@ -66,7 +66,6 @@ export type RealtimePresence = { userId: string; status?: string; source: string; - expiry?: string; metadata?: Record<string, any>; }